Discover core concepts behind building a simple one-page site using HTML for structure and CSS for layout and responsiveness. This quiz checks basic knowledge about layout structure, Flexbox, and responsive design for beginners.
What roles do HTML and CSS play when creating a web page?
Explanation: HTML provides the backbone or structure of a web page, organizing content like text and images. CSS styles this structure, controlling colors, positioning, and layout. CSS does not provide structure or content or replace HTML, and neither language is responsible for databases or interactivity.
When organizing a web page into parts such as a logo, navigation, and feature blocks, which HTML element is commonly used to separate these sections?
Explanation: The div element is a generic container often used to group related sections for styling or layout. img displays images, span is for in-line text, and link is for linking external resources like stylesheets.
Which CSS property enables you to lay out elements in a row or column with automatic sizing and alignment?
Explanation: The display: flex property activates Flexbox, allowing easy row or column layouts with flexible sizing and alignment. position: absolute takes elements out of the flow, float: left aligns elements horizontally but lacks Flexbox's power, and visibility: hidden only hides content.
Which mechanism allows you to apply specific CSS styles only when a screen width is below a chosen threshold, like 600px?
Explanation: The @media rule lets you define CSS that applies only under certain conditions, such as maximum screen width. @import loads stylesheets, @font-face defines custom fonts, and @keyframes is for animations, none of which manage responsive breakpoints.
If you want to add space around an HTML block and give it a black background, which properties should you use?
Explanation: background-color sets the background shade, while padding adds space inside the element's border. border and display relate to outlines and layout method, font-weight and overflow affect text styling and scroll behavior, and outline, z-index control stacking and visual highlights.