Top Banner
Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach
24

Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

Jan 03, 2016

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

Ch 10HTML and CSS Web Standards SolutionsA Web Standardistas’ Approach

Page 2: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

What exactly is the cascade ? This is how the browser resolves conflicts

of which CSS rule to apply when there is more than one CSS rule applied to the same element.

Page 3: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

Web_page.html

Page 4: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

The order of your CSS rules is important

Page 5: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

The BOX model

Source: http://www.w3.org/TR/CSS21/box.html

Page 6: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

Applying margins, borders and padding

Page 7: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

Applying margins, borders and padding

Page 8: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

Using CSS shorthand for margins, borders and padding

Page 9: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

Using CSS shorthand for margins, borders and padding

Work clockwise from top-top-right-bottom-left

Applies to margins, borders and padding

Summarized as margin: 1, 2, 3, 4 sequence

1 -top

2 -right

3 -bottom

4 -left

Page 10: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

Using CSS shorthand for margins, borders and padding

Page 11: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

<div> and <span> elementsHelp to group information into logical clusters

Often referred to as Content AreasGeneric holders of informationNo inherent meaning whereas <ul> has a definite meaning

Should contain meaningful elements such as <p>, <h1>, etc

<div> - block-level<span> - inline

Controlled byid (identification) and class (classification) attributes

Page 12: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

<div id=“content”>unique – so can only apply to

the one place<div class=“entry”>

Can be applied uniformly across many <div>

Page 13: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.
Page 14: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

Choose the names for the identifiers carefully Have meaning Use a-z/A-Z/0-9,-_ Start with a letter and be careful as

Header is considered different from header by the browsers.

Page 15: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

Each div in a layout can be given a: width, height, colour and position.

Page 16: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

A one-column CSS layout

Page 17: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

auto;

Page 18: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

Centering text

Page 19: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.
Page 20: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

Using Descendant or Contextual Selectors to Minimise Markup

Look for any <p> within a <div> called footer

Page 21: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

<span class=“entry”>Can be applied uniformly across many <span>Can be located within a Block-level element

Page 22: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

<img src="images/king_kong.jpg" width="500" height="350" alt="The mighty King Kong, a fearsome giant ape." title="King Kong contemplates scaling yet another tall building." class="portrait" />

Page 23: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

Background images in CSS Body

Other elements can also have images in their background

Page 24: Ch 10 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.

Background images in CSSbody {background:url(../images/darkblueGrad2.gif) repeat-x;background-color:#01A9EA;font-family: Verdana, Arial, Helvetica, sans-serif;//font-size:0.7em;font-size:62.5%;text-align: center; /* this centers the container in IE 5* browsers.The text is then set to the left aligned default in the #containerselector */color: #666666;}

Other elements can also have imagesin their background