-
Hajipur, Bihar, 844101
CSS allows you to apply shadows to text and elements to give them depth and enhance the visual appearance. The two main shadow properties are:
text-shadow
box-shadow
text-shadow
Adds shadow to text content.
text-shadow: h-offset v-offset blur-radius color;
h1 {
text-shadow: 2px 2px 4px gray;
}
h-offset
: horizontal shadow
v-offset
: vertical shadow
blur-radius
: blur level (optional)
color
: shadow color
box-shadow
Adds shadow to boxes like divs, buttons, cards, etc.
box-shadow: h-offset v-offset blur-radius spread color;
div {
box-shadow: 4px 4px 10px 0 rgba(0, 0, 0, 0.3);
}
spread
: size of the shadow expansion
Makes the shadow appear inside the element.
box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.4);
You can apply more than one shadow by separating them with commas:
box-shadow: 0 0 10px red, 0 0 20px blue;
h2 {
color: white;
text-shadow: 1px 1px 2px black;
}
Higher blur-radius
gives a smoother, softer shadow.
box-shadow: 0 0 30px 0 rgba(0,0,0,0.5);
Q1. Add a simple text-shadow
to an <h1>
tag.
Q2. Apply a box-shadow
to a div
with slight blur.
Q3. Make a glowing text effect using white text and dark background.
Q4. Add multiple shadows (red and blue) to a box.
Q5. Apply an inset shadow inside a container.
Q6. Create a shadowed button with no blur.
Q7. Style a card with a soft drop shadow.
Q8. Add text-shadow
using only horizontal and vertical offsets.
Q9. Make a circular shadow around an image.
Q10. Combine inset
and regular
box shadows in one element.
Q1: Which property adds shadow to text?
Q2: Which shadow property affects a div or button element?
Q3: What does blur-radius control in a shadow?
Q4: Which keyword is used for inside shadows?
Q5: Which part of box-shadow is optional?
Q6: How to apply multiple box shadows?
Q7: What will box-shadow: 0 0 0 0 black; do?
Q8: What does a higher blur-radius create?
Q9: Can text-shadow be applied to paragraph text?
Q10: Which of these is a valid full box-shadow value?