CSS, Cascading Style Sheets, are web documents that allow stylisation of HTML documents. CSS allows you to change the size, style, font, and colour of text; margins and padding; background colours and border styles. To change the appearance of something in CSS, there must be the following format:
h1 {
Background-color: red;
}
which would make the background colour of heading 1 tags (big headings) red. The spellings in CSS are American, for example color, and semicolons are extremely important. The following hyperlink has a list of all the CSS commands and what they do when you click on them.
Cascading Stylesheets (CSS) allow the size, style, font & colour of text; background colours & border styles and more to be changed in HTML pages.
A page without CSS can be very bland and boring:
But one with CSS looks a lot more presentable:
CSS declarations use the tag names (e.g. p), classes and IDs of
the elements on the page in order to style them. IDs are written with a preceding hashtag,
classes are written with a preceding full stop and tag names are written without any preceding characters.
The styles themselves (like height) should all end in semicolons. A comment in CSS is started
with /* and ended with */.
Here are some example declarations:
p {
/* this changes the font size of all p elements */
font-size: 3rem;
}
.class_name {
/* this changes the height of all elements with the class name 'class_name' */
height: 200px;
}
#id_name {
/* this changes the font of all elements with the ID 'id_name' */
font-family: 'Roboto'
}