next page page above previous page

Next: Handling Style Data Up: Lecture 8 Previous: Presentation

Adding Style Data

Style instructions can be given in

Style declaration for HTML might be internal to page

<style type="text/css">
  body { background-color: lime; font-size: 10pt}
  h1 { color: maroon; font-family: helvetica}
</style>

or given via external link in HTML head section

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

or specified by style attribute on an HTML tag

<h3 style="color: aqua; font-size: 30pt">Conclusion</h3>

Style can also be declared by importing style directives in files.

color: red;
@import url("http://style.com/newlook.css");
@import "http://style.com/default.css";
font-size: 18pt

Stylesheet declarations are given in XML by processing instructions

<?xml-stylesheet type="text/css" href="style.css"?>

Where style declarations conflict, internal override external ones.

This is why style sheets in CSS are said to cascade.


Lecture 8XHTML 1.0Slide 3