HTML CSS Using the id attribute Code For Website - Learn About Website | DaddyFile

0

The id Attribute Explain

All the examples above use CSS to style HTML elements in a general way.
To define a special style for one special element, first add an id attribute to the element.

then define a style for the element with the specific id:



Html Code:

<!DOCTYPE html>
<html>
<head>
<style>
#p01 {
    color: blue;
}
</style>
</head>
<body>

<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p id="p01">I am different.</p>

</body>
</html>



Html Code Result:

This is a paragraph.
This is a paragraph.
I am different.

Post a Comment

 
Top