Академический Документы
Профессиональный Документы
Культура Документы
on
Cascading Style Sheets
by
Sayandeb Pal
Introduction
• CSS is used by both the authors and readers of web pages
to define colors, fonts, layout, and other aspects of
document presentation. It is designed primarily to enable
the separation of document content (written in HTML /
XHTML / XML) from document presentation (written in
CSS) to improve content accessibility, provide more
flexibility and control in the specification of presentational
characteristics, and reduce complexity and repetition in the
structural content.
• The term cascading derives from the fact that multiple style
sheets can be applied to the same Web page.
Types of CSS
• Author styles (style information provided by the web page author)
– external stylesheets, i.e. a separate CSS-file referenced from the
document
– embedded style, blocks of CSS information inside the HTML
document itself
– inline styles, inside the HTML document, style information on a
single element, specified using the "style" attribute.
• User style
– a local CSS-file specified by the user using options in the web
browser, and acting as an override, to be applied to all
documents.
hr {color: sienna}
p {margin-left: 20px}
body {background-image: url("images/back40.gif")}
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
Embedded Style Sheets
• An embedded style sheet should be used when a single
document has a unique style.
<head>
<style type="text/css">
body { background: #fff; color: #000; }
h1, h2 { font-style: italic; font-weight: bold; color: blue; }
</style>
</head>
Inline Style Sheets