Lecture Notes 8:
Advanced CSS layout

CSE 190 M (Web Programming), Spring 2007

University of Washington

Reading: Sebesta Ch. 6 sections 6.1 - 6.4

Valid XHTML 1.0 Strict Valid CSS!

The position property (examples)

div#rightside {
    position: fixed;
    right: 10%;
    top: 36%;
}
Here I am!

Absolute positioning

absolute positioning

Absolute positioning details

absolute positioning

The z-index property

z-index

Fixed positioning

fixed positioning

Negative corners

fixed positioning

Details about inline boxes

The vertical-align property

vertical-align example

<p style="background-color: yellow;">
<span style="vertical-align: top; border: 1px solid red;">
Don't be sad!  Turn that frown 
<img src="sad.jpg" alt="sad" /> upside down!
<img style="vertical-align: bottom" src="smiley.jpg" alt="smile" /> 
Smiling burns calories, you know.  
<img style="vertical-align: middle" src="puppy.jpg" alt="puppy" /> 
Anyway, look at this cute puppy; isn't he adorable!  So cheer up,
and have a nice day.  The End.
</span></p>

Don't be sad! Turn that frown sad upside down! smile Smiling burns calories, you know. puppy Anyway, look at this cute puppy; isn't he adorable! So cheer up, and have a nice day. The End.

Common bug: space under image

<p style="background-color: red; padding: 0px; margin: 0px">
<img src="images/smiley.png" alt="smile" />
</p>

smile


The display property

h2 { display: inline; background-color: yellow; }

This is a heading

This is another heading


Practice problem: Smiley color