Friday, October 25, 2013

[Html School] Introduction to CSS

Introduction to CSS

CSS is a collection of formatting rules that control the appearance content of a Web page. Except the basic formatting text (font, size, style) can be uniformly set margins, frames, how to wrap text and objects to all parties in the presentation. CSS formatting rule consists of two parts: a selector and a declaration. Selector is the style name or tag (such as td, p, h1, ...) a statement describing the style. Declaration itself is also composed of two parts: the properties and values.

The biggest advantage of using CSS is the ease updating, because updating the CSS style
automatically updates the appearance of the parties that style applied.

Example of css code 

<style type="text/css">
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-style: italic;
background-color: #FF0000;
text-align: justify;
option {
color: #0000CC;
In this example, the body selector and declaration pairs of attribute-value are specified
inside the braces. The above style refers to the body element, define the font, size and style of font. It then sets the background color to red (# FF0000), and basic text alignment to justified (justify).

Specifying links to a special CSS file that holds selectors and declarations:

<link rel="stylesheet" type="text/css" href="nameofcssfile.css">

By specifying rules in the HTML tags which these rules apply.

The example shows how to change the color of text in a paragraph and make a left alignment of text.

<p style="color:sienna;margin-left:20px">This is a paragraph.</p>


Post a Comment


Every monday and friday new html lesson on Computershole