font-family property in CSS and how fallback fonts work. Give an example.Answer:
font-family property in CSS sets the type of font used for displaying text on a webpage.h1 {
font-family: "Times New Roman", serif;
}
If "Times New Roman" isn't available, the browser uses any available serif font.
font-style property influence the appearance of text? Mention the possible values and their effects.Answer:
font-style property changes the slant or posture of the text.normal – Displays the regular text with no slant.italic – Shows the text in a slanted style, commonly used to emphasize parts.oblique – Similar to italic but less commonly used, it's a slanted version of normal text.font-style helps p {
font-style: italic;
}
makes the paragraph content appear slanted.
text-align property and its different values. How does it affect the readability of text?Answer:
text-align property controls the horizontal alignment of text inside an element.left – Aligns text to the left, which is the default and easiest to read for left-to-right languages.center – Centers the text, often used for headings or titles.right – Aligns text to the right, used in special layouts or right-to-left languages.justify – Adjusts spacing so the text aligns evenly on both left and right sides, creating a neat block like in newspapers.div {
text-align: justify;
}
makes paragraphs neatly aligned on both sides.
font-weight in CSS? How can it be used to improve user interface design?Answer:
font-weight property adjusts the thickness or boldness of the font used in the text.normal (regular thickness) to bold (heavier weight), and also includes bolder and lighter for relative changes.h2 {
font-weight: bold;
}
makes headings stand out by thickening the text.
em and % for font-size differ from fixed units like px? Why are relative units important?Answer:
font-size property defines the size of text and can use fixed units like px (pixels) or relative units like em and %.px sets an exact size (e.g., 16px), which is consistent on most screens but may be less flexible on different devices or zoom settings.em and % sizes are relative to the parent element's font size. For example, 1.5em means 1.5 times the size of the parent.px, understanding relative units is useful for flexible webpages.Answer:
font-family, font-style, font-size, font-weight, and text-align allows web designers to customize text presentation effectively.font-size to a comfortable value (like 18px) ensures users can read without strain.font-style: italic to quotes emphasizes them distinctly, and font-weight: bold draws attention to titles or important information.text-align (centered for headings, justified for paragraphs) creates an organized layout.p {
font-family: Verdana;
font-style: italic;
font-size: 18px;
font-weight: bold;
text-align: center;
}
creates a stylish, legible, and well-structured text block.
Answer:
font-family: Use clean, easy-to-read fonts like Arial or Verdana to ensure clarity.font-size: Use larger font sizes (e.g., 20px or more) so text is easily visible to children.font-weight: Prefer normal or slightly bold to keep text clear but not harsh.font-style: Avoid italic or oblique unless emphasizing small parts; italics can be harder for children to read.text-align: Left alignment is standard and easiest to follow for young readers; avoid center or justified text in body paragraphs.text-align: justify might not always be the best choice for web page text.Answer:
text-align: justify creates neat edges on both left and right, it can cause uneven spaces between words especially on narrow screens or with short lines.Answer:
h1 {
font-family: "Times New Roman", serif;
}
<h1> heading if it is installed on the user’s device.Answer:
font-size too low) can strain users’ eyes, especially those with visual impairments.font-family) may reduce readability, confusing users or making the site look unprofessional.italic or oblique text (font-style) can make reading slower and tiring.font-weight can distract readers and reduce clarity.