CIS195 Web Authoring 1: HTML

More Page Layout Using CSS

Topics by Week for the Ten-Week Term
1. Intro to HTML 6. Layout with CSS
2. More HTML, file paths 7. CSS Grid, Flexbox
3. Site structure and navigation 8. HTML Forms
4. Formatting with CSS 9. Multimedia, Final
5. Project Propposal, Midterm 10. HTML Tables, Project Completion
11. Final

Contents

Q and A

Introduction

This week we will be talking about using CSS for page layout (design), which is different from formating. The difference is that layout involves controlling the position of things on the page rather than just their appearance.

Backgrounds

Backgrounds are colors or images that are in the background of a particular element of your page. If you use body as the selector, then the background will be for the whole body of your page. Using html as the selector will apply the background to the whole page.

CSS background properties

Background Images

Set a background image:

Make an image fill the browser viewport:

Make an image stretch to fit the body:

Center the background image:
(The height of the containing element can be set to determine vertical centering.)

Background shorthand property:

Example of a Background Image

Web Page with LCC Center Building Background Image

 

Page Design

Fixed Layout

Uses absolute sizes to keep the page at a fixed size.

Fluid Layout

Uses percentages to allow the page expand or contract to fit the size of the browser.

 

Float and Clear

Float

The float property is used with block elements to position them side-by-side (instead of one above another) and to make them move as far as they can to either the left of right.

Example:

Clear

The clear property is used to cancel the float property and put the element back into the normal flow of the page.

Example:

 

Example: Float Demo

Exercise: CSS Float and Clear properties

 

Example

References


Creative Commons License Web Authoring Lecture Notes by Brian Bird, 2017, updated , are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.