What is CSS?


Cascading Style Sheets (CSS)

is a style sheet language used to describe the presentation semantics (the look and formatting) of a document written in a markup language. Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g., fonts, colors, spacing) to Web documents. CSS is the W3C standard for defining the visual presentation for web pages.

CSS Example:

<html>
<head>

<style type=”text/css”>

body
{
font: 1.1em sans-serif;
background: #FFEBCD;
color: white;
padding: 10px;
text-align: justify;
}

p
{
font-family:”Times New Roman”;
font-size:20px;
}

</style>
<title>CSS SAMPLE </title>
</head>

<body>

<<h2> CSS Example! </h2>
<p>Web pages are interesting, but on their own they are simply documents. :-)</p>

</body>
</html>

Try it on yourself to see how it works! Just go to notepad copy & paste the above code then save as .html or .htm. Take a look for the picture below:

CSS Syntax

A CSS rule has two main parts: a selector, and one or more declarations:

The selector is normally the HTML element you want to style. Each declaration consists of a property and a value. The property is the style attribute you want to change. Each property has a value.

CSS declarations always ends with a semicolon, and declaration groups are surrounded by curly brackets:

p
{
color:red;
text-align:center;
}