Objective
To learn CSS layout techniques by recreating this
web page.
Discussion
Rounded corners can be easily achieved using CSS3. This means IE 8 and older browsers that don't support CSS3 will only see square corners, but that is a small sacrifice. Mozilla (Firefox) and Webkit (Safari/Chrome)
browsers are supported with backwards compatible code that have been available for years.
As a bonus, we'll also make use of Google web fonts for a headline.
Procedure
Prepping for the exercise
- download starter files
- download CSS reset starter files (move CSS files to proper location)
- launch Illustrator, file > new (profile=web, 640x480)
- rectangle tool: opt+click: 10x10px
- fill=white, stroke=none
- window > transparency: opacity=40%
- file > save for web "40.png": preset=PNG24, transparency=yes
- file > new (profile=web, 640x480)
- rounded rectangle tool: opt+click: 225x30px, radius=15
- fill=#9F5F33, stroke=none, duplicate vertically, snap
- make 2nd button darker
- file > save for web "button.png": preset=PNG24, transparency=yes
Creating the page structure
- launch dreamweaver
- open "curvy.html" (note structure)
- window > CSS: link "reset.css", "font.css"
- window > CSS: add CSS styles to "layout.css" (+):
• body: background: image="wood.jpg", min-width=1024px
• #header: box: height=100px, bg=#9F5F33, margin-bottom=30px
• #content: box: width=90%, margin left/right=auto
• #footer: box: height=50px, margin top=30px, padding-top=10px
• #leftColumn: box: width=25%, float=left
• #rightColumn: box: width=25%, float=right
• #mainColumn: box: width=48%, margin left/right=auto
- add a thin red border to the 3 "columns" (temporary)
- save, file > preview in browser (opt+F12 and cmd+F12)
Adding rounded corners to main column
- select main text: insert > layout objects > div tag "#main"
- window > CSS: add CSS styles to "layout.css" (+):
• .rounded20: border-radius=20px; -webkit-border-radius=20px;
-moz-border-radius=20px
• #main: bg image="40.png", width=90%, margin-left/right=auto
- select <div#main>; add style ".rounded20"
- save, file > preview in browser (opt+F12 and cmd+F12)
Adding rounded corners to right column
- select "art.jpg": insert > layout objects > div tag "#right"
- select <div#right>; add style ".rounded20"
- new CSS style "#right": bg image="art.jpg", float=right
- replace "art.jpg" with "spacer.gif" (match width/height)
- save, file > preview in browser (opt+F12 and cmd+F12)
Adding rounded corners to menu buttons
- window > CSS: add CSS styles to "font.css" (+):
• a: bold, color=#9F5F33, decoration=none
• a:hover: decoration=underline
- window > CSS: add CSS styles to "menu.css" (+):
• #leftColumn p a:
box: height=30px; width=225px; display=block
• #leftColumn a:
font-size=1.2em,
wieght=bold, color=white;
background-image=buttons.png
• #leftColumn a:hover:
text-decoration=none;
background-image=buttons.png,
background-position: x=0px, y=30px
- save, file > preview in browser (opt+F12 and cmd+F12)
Fine-tuning the CSS
- edit "h1": box: padding-top=0
- edit "#leftColumn p a":
box: width=185px, padding-left/right=20px;
height=15px, padding-top=6px,
padding-bottom=9px
- edit "#main": box: padding=20px
- edit "#footer": border-top: thin, white, dashed
- new CSS style "#leftColumn p":
padding-bottom: 1.5em
- remove thin red border from the 3 "columns"
- save, file > preview in browser (opt+F12 and cmd+F12)
Adding Google web fonts
- browse to www.google.com/webfonts#HomePlace:home
- search for "anton", click "quick use" and follow instructions
- new CSS style ".tophead" (in "fonts.css"):
• type=white, size=36px
• box: margin-left/right=auto, width=90%, padding-top=30px
- add in code view: font-family: 'Anton', sans-serif;
- save, file > preview in browser (opt+F12 and cmd+F12)
Grading
- publish file (see separate lesson)
- make a link from your process page to this assignment