1. CSS
and
Layout
Jussi
Pohjolainen
Tampere
University
of
Applied
Sciences
2. XHTML
Related
CSS
Elements
• You
can
group
XHTML
–
page
using
div
and
span
elements
• div
and
span
elements
do
not
do
anything,
unless
they
are
connected
to
css
• xhtml:
– <p>Text text text <span class="important">text
text</span>. Text text text.</p>
• CSS:
– span.important { color: RGB(255,0,0); }
3. span
and
div?
• By
using
div,
you
can
divide
xhtml
–
page
in
to
logical
pieces.
The
posiKon
of
these
are
defined
in
CSS
– Example:
navigaKon,
header,
footer,
contents
• Span
is
used
to
give
layout
for
text
4. span
and
div
<div class="header">
<h1>Title</h1>
</div>
<div class="contents">
<p>Contents: <span
class="highlight">this is different</span></p>
</div>
<div class="footer">
<p>Copyright 2008</p>
</div>
5. Layout
Basics
• XHTML
page
is
divided
into
“boxes”
by
using
the
div-‐element
• Box
consists
of
– Content
– Padding
– Border
– Marginal