HTML and CSS Certification Practice Test

Image Description

Question: 1 / 400

Which declaration correctly specifies the font size in CSS?

font-size: 20;

font-size: 20px;

The declaration that correctly specifies the font size in CSS is based on the use of a unit of measurement. In CSS, font sizes can be set using various units, with "px" (pixels) being one of the most commonly used.

Using "font-size: 20px;" is correct because it explicitly defines the font size as 20 pixels, which is a standard unit of measurement in web design. Pixels are an absolute measurement and provide a clear indication of how large the text will appear on the screen.

The other options lack the necessary syntax or use incorrect terminology. The first choice does not include any unit of measurement, which is required in CSS. The third choice incorrectly phrases the unit of measurement as "pixel," which is not a valid CSS syntax. The fourth option, "20pt," uses points as a measurement, which is also valid but less common for web font sizing compared to pixels.

This understanding of CSS syntax and units is essential for effectively styling web pages.

Get further explanation with Examzify DeepDiveBeta

font-size: pixel 20;

font-size: 20pt;

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy