Lecture No. 5 - CSS3

Prepared by: Engelbert Paul O Dela Cruz

Introduction to CSS3

CSS (Cascading Style Sheets) was created to separate content from presentation and ensure a consistent design across multiple webpages.

Why CSS?

HTML was never meant for styling. The <font> tag made pages hard to manage. CSS solves that.

CSS Syntax

A CSS rule-set includes a selector and a declaration block:

selector {
  property: value;
}

Selectors

Comments

/* This is a comment */

Ways to Insert CSS

Cascading Order

  1. Inline Styles
  2. Internal Styles
  3. External Styles
  4. User Settings
  5. Browser Defaults

CSS Colors

Ways to specify color:

Backgrounds

body {
  background: #fff url("img_tree.png") no-repeat right top;
}

Borders

p {
  border: 2px solid red;
  border-radius: 5px;
}

Height and Width

Specify dimensions using px, %, cm, etc. max-width controls how wide an element can grow.