Content Area
This is an example of a
basic Left Sidebar layout using CSS
This page was created using common and simple
techniques, it is not perfect but is intended to serve as an example of
how a typical KompoZer user might use CSS to create this popular site
layout,
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Mauris
ultricies, sapien nec suscipit lacinia, lorem lacus tempus velit, eget
placerat enim orci ut lectus. Vestibulum mi. Integer at felis quis quam
eleifend vulputate. Maecenas rutrum metus at orci malesuada hendrerit.
Nullam turpis sapien, malesuada vitae, auctor id, hendrerit ut, risus.
Donec mattis. Mauris euismod. Duis non tortor eget est euismod
eleifend. Praesent in erat. In vitae tellus vitae risus sagittis
adipiscing. Maecenas eget lectus sed nisi porttitor vestibulum.
Suspendisse feugiat purus vel metus. Cras eu enim vitae tortor sodales
gravida. Curabitur ac mi. Proin leo elit, imperdiet et, consectetuer
vehicula, condimentum vitae, est. Cras orci quam, placerat tristique,
ultricies ac, luctus at, est. Sed eget est. Nam vel risus eu diam
mollis cursus.
If you are following along and creating this example you may
want to
enter only the content text above this sentence, in which case a navbar
division height (step 22) of 350px should be sufficient.
Setting Up KompoZer
Before you begin you must set Kompozer up as follows:
- On the menu bar
select View > Show/Hide:
a. Check Format Toolbar 1
b. Check Format Toolbar 2
- On the menu bar select Tools >
Options > Settings > General:
a. Check "Maintain table Layout when inserting or deleting
cells"
b. Check "Use CSS styles instead of HTML elements and attributes
- On the menu bar select Tools >
Options > Settings > Advanced:
a. Check Markup > Language:
HTML 4
b. Check Markup >
DTD: Transitional
c. Check Behavior of Return Key > Return in a paragraph always
creates a new paragraph
Creating
the Page Step by Step:
Start with a new page and before going on click
Save, give the page a title when it asks and save the file. If you want
this to be your home page save the file as index.html, otherwise give
the file a descriptive name when saving it. The instructions below are
very descriptive and detailed, this is done to accommodate users of all
levels but particularly new users who may want to follow along step by
step on their own.
Note that I approach the layout of the page in a manner completely
different than that of an author creating a table lay out. When using
CSS I start by first creating the structure of the layout in CSS, this
will make it easier to add content later.
Setting up the
Layout Structure
- Click
on CaScadeS
Create the Wrapper
Division
- Click on
the painters
palette to get the drop down menu.
- Click on
> Style Rule
- Check
"style applied to an
element with specified ID attribute"
- Name the
rule "#wrapper" in
the box
provided above the "Create Style rule" button.
- Click
the "Create
Style rule" button
- Click
the > Box
tab and set the following:
width: 90%
margin-right: auto
margin-left: auto
- Do NOT
hit ok... (If you
do CaScadeS will close and you will have to reopen it!)
Create the Header
Division
- Click on
the painters
palette to get the drop down menu.
- Click on
> Style Rule
- Check
"style applied to an
element with specified ID attribute"
- Name the
rule "#header" in
the box
provided above the "Create Style rule" button.
- Click
the "Create
Style rule" button
- Click
the > Text
tab and set the following:
color: white
text-align: center
- Click
the >
Background tab and set the following:
color: #666666
- Click the > Box tab and set the following:
height: 111px (to set the total height of the header area)
- Do NOT
hit ok... (If you
do CaScadeS will close and you will have to reopen it!)
Create the NavBar
Division
- Click on
the painters
palette to get the drop down menu.
- Click on
> Style Rule
- Check
"style applied to an
element with specified ID attribute"
- Name the
rule "#navbar" in
the box
provided above the "Create Style rule" button.
- Click
the "Create
Style rule" button
- Click
the >
Background tab and set the following:
color: #FFFF00
- Click the > Box tab and set the following:
width: 150px
height: 350px (or a height as needed, this page uses a height of 3600px)
float: left
- Do NOT
hit ok... (If you
do CaScadeS will close and you will have to reopen it!)
Create the Content
Division
- Click on
the painters
palette to get the drop down menu.
- Click on
> Style Rule
- Check
"style applied to an
element with specified ID attribute"
- Name the
rule "#content" in
the box
provided above the "Create Style rule" button.
- Click
the "Create
Style rule" button
- Click
the >
Background tab and set the following:
color: #FFFFFF
- Click the > Box tab and set the following:
padding-left: 155px;
- Click Ok to close CaScadeS
- Save your work
Adding and styling Header, Navigation and Content
text
- Type in the text "Header" and hit enter
- Type in the text "Navigation Bar" and hit enter
- Type in the text "Content Area" and hit enter
- Save your work
Adding and styling Header text
- Highlight the text "Header"
- From Toolbar 1 format dropdown list select > Generic
Container
(div)
- At the bottom of the Kompozer Window right click on the
<div> tag and select
ID > header
- Click > End key and then click > Enter to add
a new line
- Type in the text "Vanilla Site created with CSS" and
highlight
this text
- From Toolbar 1 format dropdown list select > Heading
1
The header is now complete
- Save your work
Adding and styling Navigation Bar text and links
- Highlight the text "Navigation Bar"
- From Toolbar 1 format dropdown list select > Generic
Container
(div)
- At the bottom of the Kompozer Window right click on the
<div> tag and select
ID > navbar
- Click > End key and then click > Enter to add
a new line
- Click Insert > Link
a. Enter the Link text ("Link 1" can
be used,
in the
example Gary777
included a link back to the home page for ease of
use in
this example)
b. Enter a URL for the link in the link location section (# was used in
the example to refer to the
same page)
c. Click > OK
- Repeat Steps 50 and 50a - 50c until you have links
1 - 3
inserted.
- Highlight the text "Navigation Bar"
- Click on the Center Icon on Toolbar 2 (this creates an
inline
style)
- Click on the Bold Icon on Toolbar 2 (this creates an inline
style)
Adding and styling Content Area text
- Highlight the text "Content Area"
- From Toolbar 1 format dropdown list select > Generic
Container
(div)
- At the bottom of the Kompozer Window right click on the
<div> tag and select
ID > content
- Click > End key and then click > Enter to add
a new line
a. Enter one or more paragraphs of descriptive text
b. Highlight the text breaking your selections into logical paragraphs
by highlighting text and selecting Paragraph from the Format 1
toolbar (by
default it says Body)
c. Click Ok
- Repeat Steps 58 and 58a - 58c until you are done.
- Save your work
You should
now have a page that
looks exactly like this page
(with the exception of any text you decided to add or leave out from
the
content area.)
Converting the
internal style sheet to an external Style Sheet
- Click on CaScadeS
- Click "Export stylesheet and switch to exported version"
- Name you new css file and be sure to include the extension
.css (the style sheet in this example is named gary777.css)
- Click Save
When uploading this file to your server you must remember to also
upload the CSS file created in steps 61-64, otherwise your page will
default to no styles at all.
Extending the example -
An Alternate Style Sheet
When you click on the Alternate Style Sheet link below a new hidden
division will appear explaining step by step how to extend the
original
design. You may have to allow your browser to run javascript on this
page if you currently have it disabled. Try it out!
Alternate
Style Sheet - Change to an Alternate Style
sheet that extends the design via CSS.
Default
Style Sheet
- Switch back to the default Style Sheet.
Note that this section of the page only
shows up when using the Alternate Style Sheet! Also note that we will
not be explaining how to create an alternate style sheet or how to
create this hidden division in this tutorial, if you'd like to know how
feel free to ask and we will post the solution.)
How to modify
the example to
use the changes found in the Alternate Style Sheet
- Click
on CaScadeS
Create a new style
for the body
- Click on
the painters
palette to get the drop down menu.
- Click on
> Style Rule
- Check
"style applied to all elements of type"
- Name the
rule "body" in
the box
provided above the "Create Style rule" button.
- Click
the "Create
Style rule" button
- Click
the > Text
tab and set the following:
font-family: Verdana,Helvetica,sans-serif;
font-size: .8em;
line-height: 1.2em;
width: 90%
- Click the > Background tab and set the
following
background-color: #346767;
- Do NOT
hit ok... (If you
do CaScadeS will close and you will have to reopen it!)
Create a new h1 style
- Click on
the painters
palette to get the drop down menu.
- Click on
> Style Rule
- Check
"style applied to all elements of type"
- Name the
rule "h1" in
the box
provided above the "Create Style rule" button.
- Click
the "Create
Style rule" button
- Click
the > Text
tab and set the following:
font-size: 2.2em;
line-height: 2em;
- Do NOT
hit ok... (If you
do CaScadeS will close and you will have to reopen it!)
Modify the wrapper
element
- Click on
the wrapper element.
- Click
the > Box
tab and set the following:
min-width: 800px; (See
Authors note 6
below for browser support issues)
- Click
the > Background
tab and set the following:
background-color: #FFFFFF;
- Do NOT
hit ok... (If you
do CaScadeS will close and you will have to reopen it!)
Modify the header
element
- Click on
the header element.
- Click
the > Text tab and set the following:
color: #191970;
- Click
the > Background tab and set the following:
background-image: url(images/bg02097.gif); (image is available on the
server)
- Click
the > Border tab and set the following:
border-bottom: 2px solid black;
- Do NOT
hit ok... (If you
do CaScadeS will close and you will have to reopen it!)
Modify the navbar
element
- Click on
the navbar element.
- Click
the > Background tab and set the following:
background-color: #EEEEE0;
- Click
the > Border tab and set the following:
border-right: 1px solid black;
- Click
the > Box tab and set the following:
height: 4000px;
- Do NOT
hit ok... (If you
do CaScadeS will close and you will have to reopen it!)
Create the navbar a:hover style
- Click on
the painters
palette to get the drop down menu.
- Click on
> Style Rule
- Check
"Custom Style rule"
- Name the
rule "
#navbar a:hover" in
the box
provided above the "Create Style rule" button.
- Click
the "Create
Style rule" button
- Click
the > Text
tab and set the following:
color: #FF0000;
- Click ok to close CaScadeS
- Save your work.
And there you have it, you have extended the original style to
add; additional color to the design, change the text line spacing a
tad,
added borders, a hover
style on navbar links and a background image.
View the CSS File
View the Default CSS File
- Notice how sparse this css file is, you can do a lot with
just a little bit of css!
View the Alternate CSS File - Still quite
sparse isn't it?
Authors Notes:
1. This layout requires that you set the height of the
navbar
division so that the left sidebar (navigation bar) height is equal to
or greater than the height of the content area. There are various ways
to make the height
equal to the content area but it is the opinion of this author that
there are no completely satisfactory methods currently available that
do not require special support, work arounds or hacks to
support all of the popular common browsers.
2. Please note that in step 32 I added padding-left: of 155px, this was
done to correct an issue when using lists in floated
divisions (there are also other methods available.) If you do not set
this padding (try deleting this property in your own example) the
numerical numbers in the list text will float outside of the content
area into the left Navigation Bar area. This is not at all what we
want. I could have set "list-style-position: inside" for the
<ol>
element in CaScadeS however Kompozer doesn't handle
nested (indented) sublists very well and aligning these is more trouble
than it is worth.
3. Please note that my use of <ol start="xx"> is
the only
thing keeping this page from validating
for HTML4 Strict, I used the start property to align section heading
titles of the tutorial for readability. This will only be an issue when
a user wishes to use lists and does not affect the original design
intent as the list items were used for
tutorial purposes only and not to replicate the base content.
4. Please note that if you chose to enter only the Latin
content
text or if you add your own text you will have to adjust the height of
the navbar division as explained in step 24. I suggest you experiment
with this property by viewing your page in different browsers to see
the difference in rendering, sometimes the differences can be dramatic!
5. Note that setting a height for the content division will
override
the padding set in step 32 while using IE7 (and possibly
others but not FF2) and the content area will shift 155px right of the
navbar division and will also flow into the
text below the content division (very messy!) The solution if you
choose to use this method is to make sure that the navigation bar
division is equal to or taller than the content area in all browsers.
(Trial and error is the only reasonable method to use.)
I am confidant that other contributors will suggest alternate work
arounds to this issue.
6. While I was creating this layout I personally
felt hampered
by
the fact that the layout is fluid or liquid (I.E. the width and height
of the Header and Content areas will vary based on user screen
resolution and the width of a users browser window.) Personally I
dislike this method as it takes control of the layout away from me as
the author, the user will most likely not see the page as I intended
them to see it. Some people have the exact opposite opinion and believe
that the user should have control of the width and height of a
page and that the author should perform additional work during the
design phase to ensure the
site will look good in almost any width or height.
As a side note, this issue would be much less problematic if IE, Opera
and others supported the min-width, max-width properties, however this
is not the case. Most current versions (October 2007) of IE and Opera
lack support completely
while Konqueror and Safari provide only partial support for this
property and these can
be buggy at times.
7. Heading tags were utilized in a different manner than in
the
original examples, I understand that some
users may disagree with my method of repeating the use of certain
heading tags, however I choose this method because I feel that
many of the tags hold equal weight in the relevance of the content
within the document for SEO purposes.
8. Discerning users will note that I included a blank space
inside
of empty browser support table cells, this was done
because IE will not render a frame around an empty table cell, the
result is a sloppy and unattractive table border. This note is provided
for informational purposes only and can be ignored by all but the most
critical and particular users among us.
Editors Notes:
The above example was made using simple methods and techniques
intentionally, the author (who is also the editor of this
example) is an experienced Kompozer user with moderate to advanced
knowledge of CSS. In the example above
the author is trying to duplicate the table design shown in the table example of the main
page using CSS.
Design
Notes:
Since the author is the initial editor of this design please refer to
the authors comments for design notes, if other editors have comments
on this
design they will be posted here in the future.
Note to Users:
Feel free to use this example as a template for your own site.
Modifications
to the "step by step" text of this page and the Editors Notes section
provided by Gary777
Back to
KompoZer by Example