190k views
0 votes
In the code below, how many pixels should the font size of the root element be set to in order to set the size of main headings to 36 pixels? html { font-size: ?} h1 { font-size: 2rem;} MCQ Options:

a. 18 pixels
b. 24 pixels
c. 36 pixels
d. 72 pixels

1 Answer

6 votes

Final answer:

To set the main headings to 36 pixels using rem units, the root element's font size should be set to 18 pixels. The calculation is 36 pixels divided by the 2 rem units set for h1 elements.

Step-by-step explanation:

When using rem units in CSS, the font size is relative to the root element, which is the html element's font size. In the given CSS, to make the main headings (h1) to be 36 pixels, you simply divide the desired pixel size by the rem units that the h1 is set to.

To calculate the necessary font size of the root element: 36 pixels (desired h1 size) / 2 (rem unit specified for h1) = 18 pixels.

Therefore, the correct font size for the html element to make h1 elements 36 pixels is 18 pixels.

User Visgean Skeloru
by
8.0k points