Lesson 4: Adding Text and Structure & Cascading Style Sheet
Lesson 4: Adding Text and Structure & Cascading Style Sheet
Definition lists
Definition lists displays a term followed by its definition. The properties inspector does not include a tool for this so use the
menu (Format > List > Definition List)
<dl> Definition list tag
<dt> This is the term tag
<dd> This is the definition tag
XHTML and Word Documents
Copying Text from a Word Document
You can simply copy text from word and past it into Dreamweaver given that your headings are in
the default heading styles (Heading 1 , Heading 2 etc..) and Normal for text paragraph.
Dreamweaver will recognise this and create it.
Importing a Word Document
Rather than copying and pasting selected text into a Dreamweaver page, you can simply import
an entire word document. As you do this you can simply select the formatting that is to be
retained.
(Refer to page 67 for exercise)
Understand CSS
CSS Style Sheet
A CSS style (also known as a CSS rule) is merely a collection of formatting attributes that is then
used to style an element on the page.
Anatomy of CSS Rule
Styles in CSS are made up of two parts:
1) Selector : Describes element that will be controlled by rule.
2) Declaration : Tells the browser that all properties contained within the braces should
be applied to the element identified by the selector.
(Refer to page 69 for example)
Understanding Selector Types
Element(Tag) Selector
This is the most basic selector in CSS. It lets you restyle an element based on it’s HTML tag.
CSS Code XHTML Code
P{color:blue;} <p>Blue Paragraph</p>
Class Selector
Lets you create rules that give an HTML element multiple looks. Example to format a paragraph
red and another blue:
CSS Code XHTML Code
p.blue{color:blue;} <p class=“blue”>Blua Paragraph</p>
p.red{color:red;} <p class=“red”>Blua Paragraph</p>
Understanding Selector Types cont…
ID Selectors
- Id selectors are very similar to class selectors. Class selectors target the class attribute, while id
selectors target the id attribute.
- ID selectors are more powerful than class selectors and will override class selectors.
Whichever method you employ to create a new CSS rule the new CSS Rule dialouge box will open.
Components of the CSS Rule Dialogue Box
Selector Type
You can choose one of four selector types depending on the rule you are creating.
Selector Name
Name will depend on which selector type you choose
Rule Definition
◦ The location where you will store the rule.
Applying Class Styles to Elements
After creating your new CSS rules you to apply them in your elements you must specify that in
each tag for the associated attribute.
Example:
You can create a class called “test” but to use it you must specify that in the class attribute for
whichever element you want to use it for.