HTML and CSS Certification Practice Test 2025 - Free HTML and CSS Practice Questions and Study Guide

Question: 1 / 400

Which of the following is a valid way to include a CSS file in HTML?

<link rel="stylesheet" type="text/css" href="style.css">

The valid way to include a CSS file in HTML is to use the link element with the attributes set appropriately. The correct syntax is `<link rel="stylesheet" type="text/css" href="style.css">`. This method tells the browser that the linked file is a stylesheet, which is essential for the browser to correctly interpret and apply the styles defined in "style.css" to the HTML document.

The `rel` attribute specifies the relationship between the current document and the linked resource, while the `type` attribute indicates the type of content being linked, which in this case is CSS. The `href` attribute contains the URL of the CSS file, allowing the browser to find and load it.

Other choices do not follow the proper HTML syntax for including CSS. For example, using `<style>` does not support a `src` attribute; this tag is reserved for embedding CSS directly within the HTML. Additionally, using `<css>` or `<script>` in the context presented is incorrect, as neither of these elements is meant for linking CSS stylesheets. This highlights the importance of using correct HTML markup as it directly impacts how a page is rendered and styled.

Get further explanation with Examzify DeepDiveBeta

<style src="style.css"></style>

<css href="style.css"></css>

<script href="style.css"></script>

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy