HTML provides the tools for structuring and organizing the content of Web pages but it is not intended to shape the way that content looks other than in a very basic way.
That is where Cascading Style Sheets come in.
CSS can control the style and layout of a single individual item on a Web page or it can control the appearance of an entire Web site all at once.
<html>
<head>
<title>
Minimal CSS Document
</title>
<style type="text/css">
body
{
background-color: orange;
}
</style>
</head>
<body>
<p>This document is a very simple CSS sample containing a single style tag which changes the background color. Compare this to its source code on the left to see the structure of the style tag.</p></body>
</html>
Tag start: | Selector: | Declarations start: | Property: | Value: | Declarations end: | Tag end: | |
<style type="text/css"> | body |
{ |
background-color | : | orange |
; } |
</style> |
Placed within an HTML document, it would look like this:
<style type="text/css">
body
{
background-color: orange;
}
</style>
Most style tags string together several declarations and, to make them easier to read, each is on a separate line.
<style type="text/css">
p
{
text-align: right;
font-size: 14px;
font-weight: bold;
color: white;
font-family: Arial, Verdana, sans-serif;
background-color: maroon;
}
</style>