CSS HOW-TOCSS3CSS TemplatesLink listContactSitemap

include CSS

CSS stylesheets can be either defined inline or included from an external file. It is also possible to define a style directly as an attribute of an element, though this method is discouraged since it violates the seperation of concerns. The other methods better leverage the advantages of CSS.

Inline definition

Use the <style>, element, the attribute type and the value "text/css"

<head>
<title>MONOROM.TO</title>
<style type="text/css"><!--
body {
background-color: #f5f5f5;
color: #a52;
font-size: 11px;
font-family: Verdana, Arial, SunSans-Regular, Sans-Serif;
}
--></style>

External CSS

Externally defined CSS is included with the "link" element.

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

The @Import statement

CSS has it's own inclusion mechanism, the @import statement. It allows you to build up your stylesheets in a modular fashion.

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

or

<style type="text/css"><!--
@import url (print.css);
@import url (name_des_styles.css);
--></style>

The media attribute

CSS2 assigns a stylesheet to a particular output media through the media attribute. It is also possible to assign a stylesheet to multiple output media.

CSS2 recognizes the following values for the media attribute

all => All output media
aural => aural devices such as screen readers
braille => braille printers
handheld => small portable devices such as PDAs
print => printers
projection => projectorsbr /> screen => screens
tty => teletype devices
tv => TVs