Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,208,139 members, 8,001,668 topics. Date: Wednesday, 13 November 2024 at 02:01 PM

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

Nairaland Forum / Science/Technology / Webmasters / CSS :: Create A Box Shadow In Different Dimensions (812 Views)

I Will Solve Your Html, Css, Php, Jquery,wordpress Issues / How To Create A Responsive Login Form Using Html, Css And Bootstrap / I Need An Expert To Teach Me PHP & CSS (2) (3) (4)

(1) (Reply) (Go Down)

CSS :: Create A Box Shadow In Different Dimensions by Software202(m): 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 afraid - 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(m): 8:02am On Nov 30, 2015
alright
Re: CSS :: Create A Box Shadow In Different Dimensions by Software202(m): 1:46pm On Oct 07, 2016
---

(1) (Reply)

How Do I Make Dis Dream Blog A Reality / My Webhost Just Folded! What Do I Do? / Content Deleted

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 26
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.