Text and Font Styles Flashcards
What will be the output of the following CSS?
p { font-weight: bold; }
<p>Hello World!</p>
The text “Hello World!” will be bold.
How do you make the text inside this <h1>
element blue?
HTML
<h1>Welcome</h1>
h1 { color: blue; }
Write the CSS rule to make all <p> elements italic.
p { font-style: italic; }
What CSS property is missing in this code to make the text underlined?
p { _ : underline; }
text-decoration
Fix the error in this CSS rule to correctly center-align text inside <div>
.
div { text-align: middle; }
div { text-align: center; }
What will be the result of this CSS on the <p>
element?
p { text-transform: uppercase; }
<p>hello world</p>
The text will be displayed as “HELLO WORLD”
How do you apply a text shadow effect to this heading?
HTML
<h1>Shadow Effect</h1>
h1 { text-shadow: 2px 2px 4px gray; }
Write the CSS rule to give a paragraph both letter-spacing of 3px and word-spacing of 6px.
p { letter-spacing: 3px; word-spacing: 6px; }
What does this CSS do?
p { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
It truncates overflowing text and adds an ellipsis (…).
What CSS property should be added to break long words inside this div?
div { width: 200px; border: 1px solid black; }
word-break: break-word;
What will be the result of this CSS rule?
p { font-variant: small-caps; }
<p>Web Development</p>
The text will be displayed as “WEB DEVELOPMENT” but with lowercase letters in small caps.
Which CSS rule correctly applies a right-to-left text direction?
<p>مرحبا بالعالم</p>
css
p { direction: rtl; }
Write a CSS rule that makes text vertical and aligned from right to left.
p { writing-mode: vertical-rl; }
What does this CSS do?
p { font-feature-settings: "liga" 1; }
It enables ligatures in fonts that support them.
Fix the mistake in this CSS rule:
h2 { font-variant-position: superscript; }
h2 { font-variant-position: super; }
What happens if you apply this CSS?
span { font-variant-numeric: oldstyle-nums; }
<span>12345</span>
The numbers will appear in an old-style numeral format.
Write a CSS rule to apply discretionary ligatures to text.
p { font-variant-ligatures: discretionary-ligatures; }
How do you ensure text maintains legibility with optimized rendering?
p { text-rendering: optimizeLegibility; }
What will happen with this CSS applied?
p { overflow-wrap: break-word; }
<p>Thisisaverylongwordwithoutanyspaces.</p>
The word will break to fit within the container.
Which CSS property allows you to control whether hyphens appear automatically?
hyphens: auto;