-
Hajipur, Bihar, 844101
CSS Text Effects are techniques that enhance the appearance of text visually using properties like:
text-shadow
text-overflow
word-wrap
writing-mode
direction
white-space
And others
These effects help make text more visually appealing, readable, or stylized.
text-shadow
Adds shadow to text.
h1 {
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
Format:text-shadow: horizontal-offset vertical-offset blur-radius color;
text-overflow
Specifies how overflowed text is handled.
p {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
🟢 Adds ...
when text is too long to fit.
white-space
Controls how white space and line breaks are handled.
p {
white-space: nowrap; /* or pre, pre-wrap, normal */
}
word-wrap
or overflow-wrap
Breaks long words into the next line.
p {
word-wrap: break-word; /* or overflow-wrap: break-word; */
}
writing-mode
Changes the direction of the text flow.
p {
writing-mode: vertical-rl;
}
🟢 Supports vertical or horizontal text orientation.
h1 {
background: linear-gradient(to right, red, blue);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
🟢 Creates colorful gradient-filled text.
h2 {
text-shadow: 0 0 5px red;
animation: glow 1s infinite alternate;
}
@keyframes glow {
from { text-shadow: 0 0 5px red; }
to { text-shadow: 0 0 20px yellow; }
}
Q1. Add a shadow to an <h1>
text.
Q2. Use ellipsis when text overflows a paragraph.
Q3. Prevent line breaks in a single-line text block.
Q4. Apply word-wrap
to break long words.
Q5. Display text vertically from top to bottom.
Q6. Create gradient-colored text using background-clip
.
Q7. Animate text shadow with two colors.
Q8. Add multiple layered shadows for depth.
Q9. Limit text to a single line and show ellipsis.
Q10. Create glowing text using @keyframes
.
Q1: Which property adds a shadow behind the text?
Q2: What does text-overflow: ellipsis; do?
Q3: Which white-space value prevents text wrapping?
Q4: Which property allows long words to break into next line?
Q5: What does writing-mode: vertical-rl; do?
Q6: Which property fills text with a gradient using clipping?
Q7: What is required to use text-overflow: ellipsis;?
Q8: Which value of white-space keeps all spaces and line breaks?
Q9: Which tag is used to apply animated text shadows?
Q10: What does -webkit-text-fill-color: transparent; do?