Web Technologies

CSS

Cascading Style Sheets - Hanging out the washing.

CSS is used to format HTML documents, such as applying fonts, colours, and wrapping. It can be written within the HTML document itself, or referenced externally by multiple pages. CSS is useful, because changes to any styles immediately affect all of the webpages referencing it.

CSS files reference classes applied to HTML tags, then apply styling to them. In order to do this, HTML tags must have ' class=" " ' written within them. An example of some CSS code is:

.text{
font-family: "Times New Roman", sans-serif;
color: red;
margin: 5px;
}

In this CSS code, "text" is the class that the styling is being applied to. In between the squiggly brackets, are attributes and their values. For instance, "color" is an attribute that defines the colour of the text, and the value of this is red, meaning the text will appear as red.