Better Box Shadows
+Better Box Shadows
+2019-01-08
- -Box shadow on HTML elements has been widely supported across most browsers for a while now, but I find the default options don't allow for much visual manipulation of the shadows in general.
-Let's take a look at a default configuration of box-shadow
:
Box shadow on HTML elements has been widely supported across most browsers for a while now, but I find the default options don’t allow for much visual manipulation of the shadows in general.
+ +Let’s take a look at a default configuration of box-shadow
:
.box-container {
box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
+
In the example above the first property number is the origin of the x-axis, the second number is the origin of the y-axis and the third is the amount of blur.
+We should also add some minimal styling to cleanup the .box-container
a little bit for our example:
<div class="box-container"></div>
-
-.box-container {
+
+<div class="box-container"></div>
+
+
+.box-container {
box-shadow: 0 4px 8px rgba(0,0,0,0.3);
- /* Styles to make it less ugly */
+ /* Styles to make it less ugly */
background: white;
border-radius: 10px;
border: 1px solid #eee;
@@ -70,20 +47,27 @@
width: 250px;
}
+
Which would render as this:
-