CSS Tutorial



CSS SHADOWS


CSS Shadows

CSS Shadows can add depth and visual interest to your elements. There are two primary types: box-shadow for elements like divs and buttons, and text-shadow for text elements like headings and paragraphs. Shadows can enhance the appearance of your design, giving it a more polished and modern look.

πŸ“ Syntax:

/* Box Shadow Syntax */
.box {
  box-shadow: 10px 10px 15px rgba(0, 0, 0, 0.3);
}

/* Text Shadow Syntax */
h1 {
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
  

πŸ§ͺ Live Example:

Box Shadow Example

Text Shadow Effect

The text shadow creates a subtle 3D effect for the heading text, making it stand out on the page.

πŸ”§ Common Properties:

  • box-shadow: β†’ Adds shadow to an element. It takes values for horizontal offset, vertical offset, blur radius, spread radius, and color.
  • text-shadow: β†’ Adds shadow to text. Similar to box-shadow, but applied to text, taking horizontal offset, vertical offset, blur radius, and color.

πŸ“± Responsive Layout Tip:

Ensure shadows aren’t too heavy on small screens. Heavy shadows can cause layout issues or make the page look cluttered. Adjust them based on screen size if needed using media queries.


🌟 Enjoyed Learning with Us?

Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!

Leave a Google Review