An HTML page contains no embedded JavaScript or CSS code. The body of the page contains only the
following line of code.
<p id=”test”>test</p>
A CSS style sheet must be applied dynamically. The style must visibly change the appearance of the
paragraph on the page.
You need to apply a style the paragraph.
Which line of code should you use?

A.
document.getElementById(“test”).style.border = “0”;
B.
document.getElementById(“test”).style.position = “static”;
C.
document.getElementById (“test”).style.padding = “15px”;
D.
document.getElementById(“test”).style.top = “5px”;
Explanation:
A: The border shorthand property sets all the border properties in one declaration.
The properties that can be set, are (in order): border-width, border-style, and border-color.
It does not matter if one of the values above are missing, e.g. border:solid #ff0000; is allowed.
Why is C not correct? It will move the paragraph 15px down which is a “visible change”. Setting border to 0 does nothing in my test….that is the default anyway, isnĀ“t it?
2
0
Answer is C.
3
0
The correct answer is C!
3
0
I agree with other commenters, C is the only one that makes a visible change.
3
0
Wrong answer:
A: border is not default for an span. so setting the border to 0 doesn’t change anything visible.
B: position static is the default for an element. the elements render in order the appear in the document flow.
D: Setting the top property only affects when the position is set to relative, absolute or static.
Correct answer:
C: padding: will move the text inside the span 15 px to each direction. So the text will be set 15px from the top and 15px from the left.
0
0
Robert, you are right with your answer but your explanation is not.
You wrote:
D: Setting the top property only affects when the position is set to relative, absolute or static.
w3schools:
If “position:static”, the top property has no effect.
https://www.w3schools.com/cssref/pr_pos_top.asp
1
0