Lec 4
Lec 4
Web Development
Module 4 –
HTML: Page Structure and Content
Models
CSS: Presentation
Contents
• HTML: Page Structure and Content Models
– Division and Span
– HTML5: Article, Section, Header, Main, Footer and
Navigation
– HTML5: Aside and Figure
• CSS: Presentation
– Application
– Selectors
– Properties
• Main (1)
• Columns (3)
• Footer (1)
May contain smaller
logical division
• Always
remember that
HTML is only
about structure
and content,
div id=“main”
<div id="news"> … </div>
how these will
<div id="info"> … </div> be presented on
the screen will
<div id="podcast"> … </div> be specified
through CSS
<div id="footer"> … </div>
6 - Web Development, © Swinburne DEMO! – div.html
Division
<div id = "header"> … </div> Presented with CSS
<div id = "banner"> … </div>
• id is used if the
style is only to
be applied to
one division on
the web page
• class is used if a
<div id="news"> … <div <div
style is to be
</div> id="info"> … id="podcast"> … applied to
</div> </div> several
elements on the
web page, for
example
multiple articles
<div id = "footer"> … </div>
7 - Web Development, © Swinburne
HTML Structure: <span>
• <span>…</span> is a generic inline level
container used to group other inline elements,
such as text.
• Similar to the <div> element, the <span> tag is
used to group content, but only for inline
content.
• Do not use a <span> when you should be
using a logical element like <em> or <strong>.
COS10005
<figure>
<img
src="http://www.swinburne.edu
.au/chancellery/mediacentre/i
mages/content/large_New_ATC_B
uilding_1.jpg" alt="ATC"
width="300" height="220" />
<figcaption>
Advanced Technologies Centre
(ATC)
</figcaption>
</figure>
<footer>…</footer>
29 - Web Development, © Swinburne
Contents
• HTML: Page Structure and Content Models
– Division and Span
– HTML5: Article, Section, Header, Main, Footer and
Navigation
– HTML5: Aside and Figure
• CSS: Presentation
– Application
– Selectors
– Properties
Declaration Block
35 - Web Development, © Swinburne
CSS: Selectors and Declarations
Curly brackets
are used to
enclose all
declarations
header {border-style:dotted;}
selector property value
section {
float : left;
width : 75%;
border-style : dotted;
}
aside {
float : right;
width : 20%;
border-style : dotted;
}
DEMO! – div.html
37 - Web Development, © Swinburne
Contents
• HTML: Page Structure and Content Models
– Division and Span
– HTML5: Article, Section, Header, Main, Footer and
Navigation
– HTML5: Aside and Figure
• CSS: Presentation
– Application
– Selectors
– Properties
Limitation:
• Embedded Can only be used for one HTML
<head> element.
<style type="text/css">
h1 {color:blue;}
… Limitation:
</style> Can only be used for one HTML
<title>…</title> page.
</head>
h1 {…}
h2 {…}
DEMO! – div.html
41 - Web Development, © Swinburne
CSS: Inheritance
html Option 1:
Individually applying CSS rules
with simple element selectors
head body h1 {color : blue;}
ul {color : blue;}
title h1 ul li {color : blue;}
li
Option 2:
Using inheritance in applying styles
DEMO! – div.html
42 - Web Development, © Swinburne
Contents
• HTML: Page Structure and Content Models
– Division and Span
– HTML5: Article, Section, Header, Main, Footer and
Navigation
– HTML5: Aside and Figure
• CSS: Presentation
– Application
– Selectors
– Properties
DEMO! – div.html
46 - Web Development, © Swinburne
CSS: Class Selector
• Apply a HTML class attribute
<p class="story" >…</p>
• Select by using the class name prefixed with a
dot "."
.story { color : blue; }
• Can be made specific to an element by adding
the HTML element before the dot "."
p.story { color : blue; }
DEMO! – div.html
47 - Web Development, © Swinburne
CSS: Grouping Selectors
• Multiple selectors are separated by comma
h1, h2, p {
color : blue;
}
header, nav {
border-style : dotted;
}
DEMO! – div.html
49 - Web Development, © Swinburne
CSS: Pseudo-Class Selectors
• pseudo-classes select HTML elements based
on their characteristics
Selector Example Description
:link a:link Selects all unvisited links
:visited a:visited Selects all visited links
:active a:active Selects the active link
:hover a:hover Selects links on mouse over
Selects the input element which
:focus input:focus
has focus
Selects every <p> elements that
:first-child p:first-child
is the first child of its parent
DEMO! – div.html
50 - Web Development, © Swinburne
CSS: Pseudo-Element Selector
• Pseudo-elements select part of a document that are
not classified by elements
• These are common publishing design techniques that
are not possible with HTML code
Selector Example Description
:first-letter p:first-letter Selects the first letter of every <p> element
:first-line p:first-line Selects the first line of every <p> element
Sitepoint CSS:
http://reference.sitepoint.com/css
CSS Tutorial / References:
http://www.w3schools.com/
CSS PRESENTATION
COLOR, FONT, BOX, LAYOUT PROPERTIES