Last active
September 3, 2024 16:56
-
-
Save ocean90/1268328 to your computer and use it in GitHub Desktop.
CSS3 Box Shadow, only top/right/bottom/left and all
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Box Shadow</title> | |
<style> | |
.box { | |
height: 150px; | |
width: 300px; | |
margin: 20px; | |
border: 1px solid #ccc; | |
} | |
.top { | |
box-shadow: 0 -5px 5px -5px #333; | |
} | |
.right { | |
box-shadow: 5px 0 5px -5px #333; | |
} | |
.bottom { | |
box-shadow: 0 5px 5px -5px #333; | |
} | |
.left { | |
box-shadow: -5px 0 5px -5px #333; | |
} | |
.all { | |
box-shadow: 0 0 5px #333; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="box top"></div> | |
<div class="box right"></div> | |
<div class="box bottom"></div> | |
<div class="box left"></div> | |
<div class="box all"></div> | |
</body> | |
</html> |
A little light shadows..
/* Shadows */
.shadow-top {
box-shadow: 0 -10px 20px -5px rgba(115,115,115,0.75);
}
.shadow-right {
box-shadow: 10px 0 20px -5px rgba(115,115,115,0.75);
}
.shadow-bottom {
box-shadow: 0 10px 20px -5px rgba(115,115,115,0.75);
}
.shadow-left {
box-shadow: -10px 0 20px -5px rgba(115,115,115,0.75);
}
.shadow-all {
box-shadow: 0 0 20px rgba(115,115,115,0.75);
}
.shadow-top-right{
box-shadow: 0 -10px 20px -5px rgba(115,115,115,0.75),
10px 0 20px -5px rgba(115,115,115,0.75);
}
.shadow-top-bottom{
box-shadow: 0 -10px 20px -5px rgba(115,115,115,0.75),
0 10px 20px -5px rgba(115,115,115,0.75);
}
.shadow-top-left{
box-shadow: 0 -10px 20px -5px rgba(115,115,115,0.75),
-10px 0 20px -5px rgba(115,115,115,0.75);
}
.shadow-bottom-right{
box-shadow: 0 10px 20px -5px rgba(115,115,115,0.75),
10px 0 20px -5px rgba(115,115,115,0.75);
}
.shadow-left-right{
box-shadow: -10px 0 20px -5px rgba(115,115,115,0.75),
10px 0 20px -5px rgba(115,115,115,0.75);
}
.shadow-bottom-left{
box-shadow: 0 10px 20px -5px rgba(115,115,115,0.75),
-10px 0 20px -5px rgba(115,115,115,0.75);
}
.shadow-top-bottom-right{
box-shadow: 0 -10px 20px -5px rgba(115,115,115,0.75),
0 10px 20px -5px rgba(115,115,115,0.75),
10px 0 20px -5px rgba(115,115,115,0.75);
}
.shadow-top-bottom-left{
box-shadow: 0 -10px 20px -5px rgba(115,115,115,0.75),
0 10px 20px -5px rgba(115,115,115,0.75),
-10px 0 20px -5px rgba(115,115,115,0.75);
}
.shadow-inset {
box-shadow: inset 0 0 20px rgba(115,115,115,0.75);
}
This was always a challenge for me. Thanks
Thanks 👍
beautiful! thanks!
Just what I needed; thank you!!
Thanks...
I need this
Thanks it worked for me. Just what I needed 👍
Great! Thanks for sharing.
Perfect! Got it working! Thanks @sksar!
thanks so much, very usefull!
Nice ! Thank you for sharing
Worked for me. Thanks!
👍
Thanks
nice :)
Danke!
Here's a complete list for one-sided, two-sided and three-sided variants: https://codepen.io/eyecatchup/full/wLZgMJ
Thanks, great illustration
Great proof
Thanks a ton!
What if I want on the top as well as bottom?
@DeathNaughtT-Github See https://codepen.io/eyecatchup/full/wLZgMJ
wuoo Thanks you !
Thanks for this dude
Thanks a lot
This is very helpful! Salamat!
hello
Thank you so much.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very cool! Thanks for sharing! I created a Codepen for the rules and added a few others as well: http://codepen.io/zeckdude/pen/oxywmm