Web Programming HTML and CSS Fundamentals 1 — Questions and Answers
Question 1: Which HTML element is used to define the structure of a web page's navigation links?
- <nav> (Correct answer)
- <menu>
- <header>
- <aside>
Correct answer: <nav>
The <nav> element is the semantic HTML5 element specifically designed to contain a set of navigation links.
Question 2: What CSS property controls the space between an element's border and its content?
- margin
- padding (Correct answer)
- spacing
- border-gap
Correct answer: padding
The padding property defines the space between an element's content and its border, inside the element.
Question 3: Which CSS display value makes an element start on a new line and take up the full width available?
- inline
- block (Correct answer)
- inline-block
- flex
Correct answer: block
The block display value causes the element to generate a block-level box, starting on a new line and stretching to fill the container.
Question 4: In HTML, which attribute is used to link an external CSS file to a web page?
- src
- href (Correct answer)
- rel
- link
Correct answer: href
The href attribute in a <link> tag specifies the URL of the external CSS stylesheet to be applied to the document.
Question 5: What does the CSS box model consist of from inside to outside?
- content, border, padding, margin
- content, padding, border, margin (Correct answer)
- padding, content, border, margin
- margin, border, padding, content
Correct answer: content, padding, border, margin
The CSS box model layers are, from innermost to outermost: content, padding, border, then margin.
Question 6: Which HTML tag is used to create a hyperlink?
- <link>
- <url>
- <a> (Correct answer)
- <href>
Correct answer: <a>
The <a> (anchor) element, combined with the href attribute, creates a hyperlink to another page or resource.
Which HTML element is used to define the structure of a web page's navigation links?