379,280 views
15 votes
15 votes
the id selector uses the id attribute of an html element to select a specific element give Example ?​

User Tim Franklin
by
3.0k points

1 Answer

21 votes
21 votes

Answer:

The id selector selects a particular html element

Step-by-step explanation:

The id selector is uses the id attribute to select a specific html element. For example, if we have a particular header which is an html element and we want to give it a particular background color, we use the id selector and give it an id attribute in the CSS file. An example of an html header with id = 'blue' is shown below. The style sheet is an internal style sheet.

!doctype html

<html>

<head>

<title>Test</title>

<style>

#blue { background-color: blue;

}

</style>

</head>

<body>

<h1 id = 'blue'>Our holiday</h1>

<p>This is the weekend</p>

</body>

</html>

User Tlrobinson
by
3.4k points