UrbanPro
true

Learn CSS from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Add shadows to boxes with HTML 5.0 and CSS 3.0

Akshay Khobragade
23/01/2017 0 0

1) Hi! lets learn how to drop shadows for the boxes. First let's create a simple box in html

<!doctype html>
<html>
<div>Hi this is a box</div>
</html>

2) Now lets give it a width, height and background-color to style a box. So in our CSS code

div{
width:300px;
height:200px;
background:#b56969;
}

3) Now we have a box, lets try adding a shadow to it, so in our css div code add-

div{
width:300px;
height:200px;
background:#b56969;
box-shadow:2px 2px 1px rgba(0,0,0,0.5);
}

4) It will cast a shadow for the box, lets discuss the box-shadow property. It needs minimum 4 parameters, x-axis-value, y-axis value, density of shadow, color.

i.e --> box-shadow:x-axis-value y-axis-value density color;

5) But there is a catch, for different brosers we have to add prefix in box-shadow property.

i) For chrome --> -webkit-box-shadow:2px 2px 1px rgba(0,0,0,0.5);
ii) For mozilla --> -moz-box-shadow:2px 2px 1px rgba(0,0,0,0.5);
iii) For IE --> -ms-box-shadow:2px 2px 1px rgba(0,0,0,0.5);
iv) For Opera --> -o-box-shadow:2px 2px 1px rgba(0,0,0,0.5);

that's it, below is the full code for box shadows,

a) HTML code

<!doctype html>
<html>
<div>Hi this is a box</div>
</html>

b) CSS code

div{
width:300px;
height:200px;
background:#b56969;
box-shadow:2px 2px 1px rgba(0,0,0,0.5);
}

thats it play with the above code for awesome box shadows

0 Dislike
Follow 0

Please Enter a comment

Submit

Other Lessons for You

Web Technology Tutorial
Web Technology has 2 category Front End (HTML,CSS,JS Etc) Back End/Server Side (PHP,JSP,ASP,ROR Etc) Front End technologies are - HTML, CSS, Bootstrap, Javascript, jQuery etc. Using front end...

Pro Developer Program Syllabus
What you will learn in Pro-Developer Program: i. Introduction to Web Technologies. ii. Introduction to .Net - Features of .Net, CTS, CLS, CLR and MSIL. iii. C# & .Net Basics - Data Types,...

How to create a Basic Webpage using HTML
This is a very small basic article about creating HTML webpages. To start with you need to create an html file. you can create a text file (.txt) then rename it to something.html file ( .html extension...

Pro Developer Program Syllabus
What you will learn in Pro-Developer Program: i. Introduction to Web Technologies. ii. Introduction to .Net - Features of .Net, CTS, CLS, CLR and MSIL. iii. C# & .Net Basics - Data Types,...

HTMl tutorial for input type
<html> <body> <form> <input type="tel" id="phone" name="phone" pattern="{10}"required><br> <input type="submit" value="Submit"> </form> </body> </html>
X

Looking for CSS Classes?

The best tutors for CSS Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn CSS with the Best Tutors

The best Tutors for CSS Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more