WEB-DEVELOPMENT-FOUNDATION practice question 12 of 15
When should HTML code primarily be used for a web page?
Full set: 75 questionsHTML's primary role is to define the structure and semantic content of a web page. Adding an image for an advertisement is a content-related task, which is correctly accomplished using the HTML element. This element embeds an image into the document, fulfilling HTML's core purpose of structuring content. The other options describe presentation or behavior, which are the domains of CSS and JavaScript, respectively, following the principle of separation of concerns in web development.
A. Adjusting column width for screen size is a responsive layout concern. This is a presentation task best handled by CSS media queries, not HTML structure.
B. Changing the background color of an element is a stylistic choice. This presentation rule should be defined using CSS (background-color property), not HTML.
D. Causing an element to continuously change size is dynamic behavior. This functionality is implemented using JavaScript, often in conjunction with CSS for animations.
1. Mozilla Developer Network (MDN) Web Docs: The element page explicitly states, "The
HTML element embeds an image into the document." This confirms its role is to add content.
Source: MDN Web Docs, ": The Image Embed element", Section: "Usage". (developer.mozilla.org/en-US/docs/Web/HTML/Element/img)
2. W3C HTML 5.2 Specification: The official standard for HTML defines the img element as the means to represent an image within the document's content.
Source: W3C, "HTML 5.2 Recommendation", Section 4.8.1 "The img element". (www.w3.org/TR/html52/semantics-embedded-content.html#the-img-element)
3. MIT OpenCourseWare: Course materials on web design emphasize the separation of concerns, where HTML is for content/structure, CSS is for presentation (style, layout, colors), and JavaScript is for behavior.
Source: MIT OpenCourseWare, 6.170 Software Studio, Fall 2012, Lecture 12: "HTML/CSS/Javascript", Slide 5 "Separation of Concerns". (ocw.mit.edu)
Keep practicing
Take the free WEB-DEVELOPMENT-FOUNDATION practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other WEB-DEVELOPMENT-FOUNDATION practice questions
- Question 2What is one of the possible values of the text-align property?
- Question 3What is matched by the :hover selector?
- Question 4What describes the matches resulting from the img: first-child selector?
- Question 5Which two color definitions are valid for use with CSS? Choose 2 answers.
- Question 8What does the timelines tool of Safari Web Inspector enable a developer to do?
- Question 9Developers consider three platforms for viewport sizes. What is one of them?
