WEB-DEVELOPMENT-APPLICATIONS practice question 13 of 25
A web designer inserts an image into a web page. Which CSS attribute should this designer use to ensure that there is one of pixel of space between the line image and the surrounding elements?
Full set: 131 questionsThe CSS margin property is used to create space around an element, outside of any defined borders. To ensure there is space between an image and the elements surrounding it, a developer should apply a margin to the image element. A margin: 1px; rule would create one pixel of space on all four sides of the image, pushing other elements away.
Content refers to the image itself, not the space around it. Padding adds space between the content (the image) and its border, which is inside the element's boundary. A border is a line drawn around the element, between the padding and the margin, not empty space.
- Mozilla Developer Network (MDN). (2023). margin. In CSS: Cascading Style Sheets. Retrieved from https://developer.mozilla.org/en-US/docs/Web/CSS/margin. The summary states, "The margin CSS shorthand property sets the margin area on all four sides of an element."
- W3C. (2018). CSS Box Model Module Level 3. W3C Candidate Recommendation. Section 2.2: "Margin Area". Retrieved from https://www.w3.org/TR/css-box-3/#margin-area. This section defines the margin area as extending from the border edge to the margin edge, providing separation.
- Miller, R., & Gancarz, M. (2011). 6.813/6.831 User Interface Design and Implementation, Lecture 4: CSS. MIT OpenCourseWare. Retrieved from https://ocw.mit.edu/courses/6-813-user-interface-design-and-implementation-spring-2011/resources/mit6813s11lec04/. The lecture notes explicitly differentiate margin as space "outside the border" and padding as space "inside the border."
Keep practicing
Take the free WEB-DEVELOPMENT-APPLICATIONS practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other WEB-DEVELOPMENT-APPLICATIONS practice questions
- Question 1Given the following JavaScript code: ```javascript var n1 = 10; var n2 = "20.39"; ``` Whi…
- Question 2Which attribute displays help text in an input field without specifying an actual value f…
- Question 4Which element attaches an external CSS document to a web page?
- Question 5Which HTML tag should a developer use to create a drop-down list?
- Question 6Which method allows the end user to enter text as an answer to a question as the page loa…
- Question 8Which layout design is easiest to manage on a variety of devices?
