Cascading Style Sheets: A Short Introduction
What are they?
CSS are a means of managing the appearance of Web pages.
They were developed in early 1996 and are the preferred method for modifying
the fonts used in your Web pages. They can be used to control almost
all aspects of a page's appearance. There are three types of CSS:
- Inline Styles
Used as an attribute within an HTML tag, such as:
<h1
style="color: blue; font-style: italic">This is the page heading</h1>
- Document-Level Styles
This is a style sheet defined within the <head> of a document. It can
be a good place to define a style or styles that will only be used in one
document. Here's an example:
<head>
<title>Sample
Web page</title>
<style
type="text/css">
<!--
.bodytext {
font-family: Arial, Helvetica,
sans-serif;
font-size: 1.0em;
}
-->
</style>
</head>
<body>
- External Style Sheets
This is an external file, which you attach to your Web pages. It can be used
with multiple pages and is generally the easiest way to employ style sheets.
Attaching an External Style Sheet in Dreamweaver
(MX 2004)
- In the Properties box, click the Style drop-down
and choose Manage Styles...
- The Edit Style Sheet window should
appear. Click the Attach... button.
- Click the Browse button and find
the external style sheet. Click the OK button to select
it.
- Click the Done button to close
the Edit Style Sheet window.
Note: Style sheets can also be
attached to the Web page by clicking the Attach Style Sheet icon
( )
in the CSS Styles panel. This works in earlier Dreamweaver versions.
Modifying Existing Style Sheets
- Click the delta to expand the Design panel.
- Choose the CSS Styles tab.
- Select a style to modify.
- Click the Edit Style... (
)
icon.
Adding a New Style
- Click the delta to expand the Design panel.
- Choose the CSS Styles tab
- Click the New CSS Style icon (
)
in the CSS Styles panel
CSS Trick: Instant Text Boxes
- Click the Code View button (
).
- Type the following in the <head> of your document
<style
type="text/css">
<!--
blockquote {
color: #000000;
background-color: #EEEEEE;
border: 1px solid #191970;
padding: 10px;
font-size: .9em;
}
-->
</style>
- Select the text to be placed in the box, and
select Text
> Indent from the menu at the top of the screen, or use the
Text Indent button (
),
in the Properties.
This is what the text box looks like. You can
modify the text color, background color, border, padding, and font
size to change the appearance of the text box.
|