1.6 KiB
1.6 KiB
title |
---|
Introduction to CSS |
Table of Contents
Introduction to CSS
What is CSS?
Cascading Style Sheets (CSS) describe how the html on a page should appear.
CSS was first proposed way back in 1994 by Håkon Wium Lie, who was working with Tim Berners-Lee at CERN.
Before CSS, developers would apply styles using attributes or special tags on each node of a page. This made markup repetitive and prone to errors.
CSS allows selectors to describe how each piece of matching content should look. It is an important technology of World Wide Web, along with HTML and Javascript.
body {
font-size: 15px;
}
a {
color: rebeccapurple;
text-decoration: underline;
}
Using CSS
External style sheets let many pages share the same styles.
<link href="styles.css" rel="stylesheet" type="text/css">
Internal style sheets apply CSS to all matching tags on a page.
<style>
h1 {
font-family: sans-serif;
margin-bottom: 1.5em;
}
</style>
Inline CSS apply styles to a single tag.
<img src="..." style="border: 1px solid red;" />