ID and classes in CSS

Home » Tutorials » HTML and CSS » ID and classes in CSS
In last lesson we learned about CSS. But how to make tags uniq for css rules?
In this lesson we’ll talk about id and classes in css and html. How to assign id and class to html tag – we’ll find out it in this lesson. It is important id must have uniq value and must occur once in document. Classes can occur a lot of times.
Also I shew, how to use google chrome console. It is very powerful tool. It helps you to test your markup.

Code lesson (HTML)

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>document</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>



<h1 id="mainHeader">Header</h1>





Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dignissimos, iste earum consequatur iusto officiis. Inventore velit quae soluta atque fugiat, ratione, rerum blanditiis, iusto repudiandae assumenda perferendis necessitatibus molestiae ab.



</body>
</html>

Code lesson (CSS)

#mainHeader {
    color: #e1e1e1;
}

.firstClass {
    color: red;
    font-size: 20px;
}

.secondClass {
    font-weight: bold;
}

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

Pin It on Pinterest

Share This