<p><font face="Arial">Welcome to Greasy Joe's. You will <b>never, <i>ever, <u>EVER</u></i></b> beat our <font size="+1" color="red">AMAZING</font> prices!</font></p>
Welcome to Greasy Joe's. You will never, ever, EVER beat our AMAZING prices!
b
, i
, u
, and font
are legal in older HTML but are deprecated in strict XHTML
.css
file
.css
file: one style sheet can be shared across many HTML documentsselector { property: value; property: value; ... property: value; }
p { font-family: sans-serif; color: red; }
link
<link rel="stylesheet" type="text/css" href="filename" />
<link rel="stylesheet" type="text/css" href="style.css" /> <link rel="stylesheet" type="text/css" href="http://www.google.com/uds/css/gsearch.css" />
link
tag appears in the head
of an HTML pagep { color: red; background-color: yellow; }
This paragraph uses the style above.
color
: color of the element's textbackground-color
: color that will appear behind the elementp { color: red; } h2 { color: rgb(128, 0, 196); } h4 { color: #FF8800; }
This paragraph uses the first style above.
This heading uses the second style above.
This heading uses the third style above.
aqua
, black
, blue
, fuchsia
, gray
, green
, lime
, maroon
, navy
, olive
, purple
, red
, silver
, teal
, white
(white), yellow
font-family
: which font will be usedfont-size
: how large the letters will be drawnfont-style
: used to enable/disable italic stylefont-weight
: used to enable/disable bold stylefont-family
propertyp { font-family: "Georgia"; } h2 { font-family: "Arial Narrow"; }
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: x-large; }
This paragraph uses the above style.
xx-small
, x-small
, small
, medium
, large
, x-large
, xx-large
smaller
, larger
90%
, 120%
px
) vs. point (pt
) vs. m-size (em
)16px
, 16pt
, 1.16em
px
specifies a number of pixels on the screen (absolute)pt
specifies number of point, where a point is 1/72 of an inch onscreenem
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)body { font-size: 16px; }
body
element
|
Edit this HTML and add the following styles to it:
|
strong
, em
better than b
, i
?strong { font-weight: normal; color: red; } em { font-style: normal; background-color: #DDDDDD; }
Now if I want to strongly emphasize something or just emphasize it, it doesn't necessarily have to be bold or italic.
strong
and em
describe attributes of the content (it is something important in the document that you want to emphasize)b
and i
describe formatting and presentation ("I want this to be bold.")text-align
: alignment of text within its elementtext-decoration
: decorations such as underliningline-height
,
word-spacing
, letter-spacing
: gaps between the various portions of the texttext-indent
: indents the first letter of each paragraphtext-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
text-decoration: overline underline;
p { width: 400px; background-color: yellow; } h2 { width: 50%; background-color: aqua; }
This paragraph uses the first style above.
width
, height
: how wide or tall to make this element
width
applies only to block elements; ignored for inline elementsmax-width
,
max-height
,
min-width
,
min-height
: the maximum or minimum size of this element in the given dimension/*
... */
/* 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 CSSp,h1,h2 { color: blue; } h2 { background-color: yellow; }
This paragraph uses the above style.
h2
above)<html><head><title>My home page</title></head> <body><h1>My home page</h1> <p>Let me tell you about my favorite composers:</p> <ul><li>Elvis Costello</li> <li>Johannes Brahms</li> <li>Georges Brassens</li> </ul></body></html>
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; }
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>
|
Edit the previously-styled Kitten HTML and add the following styles:
|