Docsity

CSS Fundamentals: Creating Web Pages with XHTML and CSS, Slides of Web Design and Development

Partial preview of the text

Download CSS Fundamentals: Creating Web Pages with XHTML and CSS and more Slides Web Design and Development in PDF only on Docsity!

CSS Fundamentals

Project 1

Project 1: Design your own web page using

XHTML and CSS.

• This is an individually graded project.

• This is due at the beginning of next lab.

• You and your partner can "consult" each other

for help, but your web page has to be your

own individual work.

Project 1

• Let’s look at Part 3.html from Lab 1 as a

model.

• Be sure not to just copy it…I’ll be able to tell

and you will get -100.

• Write your own XHTML code from scratch.

Common CSS tricks

How to make a box

My Web Page

CSS file .header { width: 800px; height: 100px; border: 1px solid black; }

CSS Trick

How to center stuff

Lots of stuff

CSS

#container { width: 790px; margin: 0px auto; }

CSS Trick

Remove annoying blank lines

Header

Some paragraph text.

CSS

h1, p { margins: 0px; }

Add an indent:

p { text-indent: 10px; }

Two rules could conflict

Visual Aspects of a Web Page

Aspects

  • Typography – fonts
  • Colors
  • Layout
  • Alignment
  • Images – background,

decorators, etc.

Depends on…

  • Device
  • Operating System
  • Browser
  • Screen Resolution
  • Display Options
  • Installed Fonts

Benefits of CSS

1. Greater Control & Options : Typography, Page

Layout Control, etc.

2. Less Work – Edit the appearance of an entire

website at once with one style sheet

3. Smaller Documents

  • No presentation HTML tags (redundant tags)
  • Style sheet downloaded once for entire site

How CSS Works

1. Structural Layer : Start with an XHTML

document with

  • Logical structure
  • Meaningful (semantic) tags

2. Presentation Layer : Write style rules for

each structural element/tag in a style sheet.

3. Attach style sheet to the XHTML document

Syntax

selector {

property: value;

property: value;

Examples:

h1 { font-size: 14px; color: red; }

.boxedpargraph { border: solid 1px black; margin: 10px ; float: left ; }

Attaching a Style Sheet

• Using link

• Importing

Attaching a Style Sheet

• It is best to store all your styles in a separate

file. Why?

• Naming Convention :

style.css or index.css

• To maintain a consistent look and feel for an

entire website, you should attach the style

sheet to every page

Other methods

  • Inline styles

  • Embedded style sheets

Other methods

  • Embedded styles are useful
    • if you have global style sheet for entire website but want to change a style for a specific page
    • Example : all pages have blue hyperlinks except homepage, which has all green links
  • Inline statements are useful
    • if you want to change a specific instance of a style
    • Example : All hyperlinks on homepage are green except for one specific link which is red