read 07

Introducing CSS

  1. What CSS does

CSS allows you to create rules that specify how the content of an element should appear. For example, you can specify that the background of the page is cream, all paragraphs should appear in gray using the Arial typeface, or that all level one headings should be in a blue, italic, Times typeface

X Rules, properties, and values

Example Styles

  1. X How CSS works CSS works by associating rules with HTML elements. These rules govern how the content of specified elements should be displayed. A CSS rule contains two parts: a selector and a declaration. CSS Associates Style rules with HTML elements,Selector ==>p { font-family: Arial;}<==Declaration

CSS declarations sit inside curly brackets and each is made up of two parts: a property and a value, separated by a colon. You can specify several properties in onedeclaration, each separated by a semi-colon.

element to indicate where the CSS file is located

Introducing CSS

</head>

From Garden to Plate

A potager is a French term for an ornamental vegetable or kitchen garden ...

What to Plant

Plants are chosen as much for their functionality as for their color and form ...

</html> body { font-family: Arial, Verdana, sans-serif;} h1, h2 { color: #ee3e80;} p { color: #665544;}

Using External CSS

example1

Using Internal CSS

ex2

Different versions of CSS & Browser Quirks CSS1 was released in 1996 and CSS2 followed two years later. Work on CSS3 has been ongoing but the major browsers have already started to implement it.

The color property allows you to specify the color of text inside an element. You can specify any color in CSS in one of three ways:

  1. rgb values These express colors in terms of how much red, green and blue are used to make it up. For example: rgb(100,100,90)
  2. hex codes These are six-digit codes that represent the amount of red, green and blue in a color, preceded by a pound or hash # sign. For example: #ee3e80 color
  3. names There are 147 predefined color names that are recognized by browsers. For example: DarkCyan

Every color on a computer screen is created by mixing amounts of red, green, and blue. To find the color you want you can use a color picker.

CSS3: HSL Colors

CSS3 introduces an entirely new and intuitive way to specify colors using hue, saturation, and lightness values.

Learn more about CSS