Skip to main content

Style an HTML page with CSS

Syntax

CSS is a simple language for defining styles of an html page. The syntax can be defined in one line:

selector { property: value; /* more properties...*/ }

Example

This example below can be viewed live here.

<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    .box {
      width: 500px;
      height: 500px;
      display: block;
      color: red;
      background-color: blue;
    }
  </style>
</head>
<body>
  <a href="https://codepen.io/Julius-Kiesian/pen/Rwzmpqq" class="box">Text in a box</a>
</body>
</html>