Except where otherwise noted, the contents of this presentation are Copyright 2009 Marty Stepp and Jessica Miller.
<meta>
(2.3.3)
information about your page (for a browser, search engine, etc.)
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="Authors' web site for Building Java Programs." /> <meta name="keywords" content="java, textbook" />
head
of your XHTML pagemeta
tags often have both the name
and content
attributes
meta
tags use the http-equiv
attribute instead of name
meta
tag for Content-Type
gets rid of validator "tentatively valid" warnings
<dl>
, <dt>
, <dd>
dl
represents a list of definitions of terms (block)
dt
represents each term, and dd
its definition
<dl> <dt>newbie</dt> <dd>one who does not have mad skills</dd> <dt>own</dt> <dd>to soundly defeat (e.g. I owned that newbie!)</dd> <dt>frag</dt> <dd>a kill in a shooting game</dd> </dl>
<blockquote>
(2.2.3)
a lengthy quotation (block)
<p>As Lincoln said in his famous Gettysburg Address:</p> <blockquote> <p>Fourscore and seven years ago, our fathers brought forth on this continent a new nation, conceived in liberty, and dedicated to the proposition that all men are created equal.</p> </blockquote>
<q>
a short quotation (inline)
<p>Quoth the Raven, <q>Nevermore.</q></p>
<p>Quoth the Raven, "Nevermore."</p>
We don't use " marks for two reasons:
"
<q>
allows us to apply CSS styles to quotations (seen later)a way of representing any Unicode character within a web page
character(s) | entity |
---|---|
< > | < > |
é è ñ | é è ñ |
™ © | ™ © |
π δ Δ | π δ Δ |
И | И |
" & | " & |
&
on a web page?<p> <a href="http://google.com/search?q=marty&ie=utf-8&aq=t"> Search Google for Marty </a> </p>
<code>
code
: a short section of computer code (usually rendered in a fixed-width font)
<p> The <code>ul</code> and <code>ol</code> tags make lists. </p>
<pre>
a large section of pre-formatted text (block)
<pre> Steve Jobs speaks loudly reality distortion Apple fans bow down </pre>
code
tags?p, h1, h2 { color: green; } h2 { background-color: yellow; }
This paragraph uses the above style.
h2
above)/*
... */
(3.1.4)
/* This is a comment.
It can span many lines in the CSS file. */
p {
color: red;
background-color: aqua;
}
//
single-line comment style is NOT supported in CSS<!-- ... -->
HTML comment style is also NOT supported in CSSproperty | description |
---|---|
font-family
|
which font will be used |
font-size
|
how large the letters will be drawn |
font-style
|
used to enable/disable italic style |
font-weight
|
used to enable/disable bold style |
Complete list of font properties |
font-family
p { font-family: Georgia; } h2 { font-family: "Courier New"; }
This paragraph uses the first style above.
font-family
p { font-family: Garamond, "Times New Roman", serif; }
This paragraph uses the above style.
font-family
value ensures that every computer will use a valid fontfont-size
p { font-size: 14pt; }
This paragraph uses the style above.
px
) vs. point (pt
) vs. m-size (em
)16px
, 16pt
, 1.16em
xx-small
, x-small
, small
, medium
, large
, x-large
, xx-large
, smaller
, larger
90%
, 120%
pt
specifies number of point, where a point is 1/72 of an inch onscreenpx
specifies a number of pixels on the screenem
specifies number of m-widths, where 1 em is equal to the font's current sizefont-weight
,
font-style
p { font-weight: bold; font-style: italic; }
This paragraph uses the style above.
normal
to turn them off (e.g. headings)property | description |
---|---|
text-align
|
alignment of text within its element |
text-decoration
|
decorations such as underlining |
line-height , word-spacing , letter-spacing
|
gaps between the various portions of the text |
text-indent
|
indents the first letter of each paragraph |
Complete list of text properties |
text-align
blockquote { text-align: justify; } h2 { text-align: center; }
[TO LUKE SKYWALKER] The alliance... will die. As will your friends. Good, I can feel your anger. I am unarmed. Take your weapon. Strike me down with all of your hatred and your journey towards the dark side will be complete.
text-align
can be left
, right
, center
, or justify
(which widens all full lines of the element so that they occupy its entire width) text-decoration
p { text-decoration: underline; }
This paragraph uses the style above.
overline
, line-through
, blink
, or none
text-decoration: overline underline;
list-style-type
property
(3.2.4)
ol { list-style-type: lower-roman; }
none
: No markerdisc
(default), circle
, square
decimal
: 1, 2, 3, etc.decimal-leading-zero
: 01, 02, 03, etc.lower-roman
: i, ii, iii, iv, v, etc.upper-roman
: I, II, III, IV, V, etc.lower-alpha
: a, b, c, d, e, etc.upper-alpha
: A, B, C, D, E, etc.lower-greek
: alpha, beta, gamma, etc.hebrew
, armenian
, georgian
, cjk-ideographic
, hiragana
, katakana
, hiragana-iroha
, katakana-iroha
body { font-size: 16px; }
body
element<link>
tag)<style>
tag in the page's header)style
attribute of the HTML element)body { font-family: sans-serif; background-color: yellow; } p { color: red; background-color: aqua; } a { text-decoration: overline underline; } h2 { font-weight: bold; text-align: center; }
A styled paragraph. Previous slides are available on the web site.
p, h1, h2 { color: blue; font-style: italic; } h2 { color: red; background-color: yellow; }
This paragraph uses the first style above.
<p> <a href="http://jigsaw.w3.org/css-validator/check/referer"> <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" /></a> </p>
property | description |
---|---|
background-color
|
color to fill background |
background-image
|
image to place in background |
background-position
|
placement of bg image within element |
background-repeat
|
whether/how bg image should be repeated |
background-attachment
|
whether bg image scrolls with page |
background
|
shorthand to set all background properties |
background-image
body { background-image: url("images/draft.jpg"); }
This is the first paragraph
This is the second paragraph...
It occupies 2 lines
background-repeat
body { background-image: url("images/draft.jpg"); background-repeat: repeat-x; }
This is the first paragraph
This is the second paragraph...
It occupies 2 lines
repeat
(default), repeat-x
, repeat-y
, or no-repeat
background-position
body { background-image: url("images/draft.jpg"); background-repeat: no-repeat; background-position: 370px 20px; }
This is the first paragraph
This is the second paragraph...
It occupies 2 lines
top
, left
, right
, bottom
, center
, a percentage, or a length value in px
, pt
, etc.<link href="filename" type="MIME type" rel="shortcut icon" />
<link href="yahoo.gif" type="image/gif" rel="shortcut icon" />
link
tag, placed in the HTML page's head
section, can specify an icon for a web page
.ico
format named favicon.ico
in the root directory of the web server (instructions)