₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,327,462 members, 8,431,166 topics. Date: Sunday, 21 June 2026 at 08:52 PM

Toggle theme

CSS :: Create A Box Shadow In Different Dimensions - Webmasters - Nairaland

Nairaland ForumScience/TechnologyWebmastersCSS :: Create A Box Shadow In Different Dimensions (857 Views)

1 Reply (Go Down)

CSS :: Create A Box Shadow In Different Dimensions by Software202(op): 10:34am On Oct 29, 2015
Have you been seeing shadow round some boxes like HTML text field or even buttons or divs? OK, don't worry. After this tutorial: You will also become an expert 'HTML Box Shadow Maker!'.


*Note: This feature is supported from CSS 3, as it will only work on modern browsers. Are you afraidhuh - Almost all browsers are modern! (lol)



A BASIC SHADOW CODE


.shadow {

box-shadow: 2px 2px 4px 5px #000;

-o-box-shadow: 2px 2px 4px 5px #000;

-moz-box-shadow: 2px 2px 4px 5px #000;

-webkit-box-shadow: 2px 2px 4px 5px #000;

}




Explaination


1. The horizontal offset of the shadow, positive means the shadow will be on the right of the box.
- A negative offset will put the shadow on the left of the box.
2. The vertical offset of the shadow: - a positive one means the shadow will be below the box and a negative one means the box-shadow will be above the box.
3. The blur radius (optional), if set to 0 the shadow will be sharp, the higher the number, the more blurred it will be.
4. The spread radius (optional), positive values increase the size of the shadow, negative values decrease the size. Default is 0 (the shadow is same size as blur).
5. Color

INNER SHADOW CODE


.shadowbox {

-moz-box-shadow: 0 0 5px #000 inset;

-webkit-box-shadow: 0 0 5px #000 inset;

box-shadow: 0 0 5px #000 inset;

}



FOR INTERNET EXPLORER

To make this possible in Microsoft Internet Explorer, you have to add some extra elements:
HTML for IE

<div class="ie-shadow">

<div class="target-content">

This is the element with the box shadow.

</div>

</div>



CSS for IE


.ie-shadow {

margin: 30px;

background-color: rgb(68,68,68); /* Needed for IEs */

box-shadow: 5px 5px 5px rgba(68,68,68,0.6);

-moz-box-shadow: 5px 5px 5px rgba(68,68,68,0.6);

-webkit-box-shadow: 5px 5px 5px rgba(68,68,68,0.6);



filter: progid:DXImageTransform.Microsoft.Blur(PixelRadius=3,MakeShadow=true,ShadowOpacity=0.30);

-ms-filter: "progid:DXImageTransform.Microsoft.Blur(PixelRadius=3,MakeShadow=true,ShadowOpacity=0.30)";

zoom: 1;

}

.ie-shadow .target-content {

position: relative; /* This protects the inner element from being blurred */

padding: 70px;

background-color: #DDD;

}


* For more posts and updates about web development and other programming related projects click on the link in the signature below, more shares and likes if you love it.
Re: CSS :: Create A Box Shadow In Different Dimensions by thewebcraft(m): 8:38pm On Oct 29, 2015
Nice smiley
Re: CSS :: Create A Box Shadow In Different Dimensions by Software202(op): 8:02am On Nov 30, 2015
alright
Re: CSS :: Create A Box Shadow In Different Dimensions by Software202(op): 1:46pm On Oct 07, 2016
---
1 Reply

I Will Solve Your Html, Css, Php, Jquery,wordpress IssuesHow To Create A Responsive Login Form Using Html, Css And BootstrapI Need An Expert To Teach Me PHP & CSS234

.Peeps, Kindly Review This New Site Design And Let Me Know Your ThoughtsGet Your Logos And Graphic Designs For Your Sites Done Today