Skip to main content

Basic selectors

Here is an example of basic selectors:

<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      color: green;
    }
    h1 {
      color: blue;
    }
    .first {
      font-style: italic;
    }
    #mydiv {
      font-weight: bold;
    }
  </style>
</head>

<body>
  <h1>Greetings</h1>
  <div class="first">How are you?</div>
  <div id="mydiv">How are you doing?</div>
  <div>How do you do?</div>
</body>

</html>

You can also view it live on codepen.