Patricia Rees
Web Producer, Pasadena City College
<font>
tags and deprecated presentation elements and attributes
of older html <blockquote>
to indent<br>
tags<body>
margin, link colors, background<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<p style="text-style: italic;">
A test
paragraph</p>
h2
style in document <style type="text/css">
tag body, p, h1, ul
body
style h1, p
and li
tag styles to document .one, .advert
custom classes to paragraph
elements
.one {color: #990000;}
<h1>, <h2>, <p>
and <div>
are
block-level tags. Unless otherwise defined in a style sheet, block elements
have a width equal to that of the browser window, and are as tall as necessary
to contain their content. As the name implies, they reserve a rectangular
area—a block—on the page. Most may contain other block-level elements as
well as inline elements.<em>
, <a>
, <img>
and <span>
are
inline elements. Inline elements only take up as much area as they need
and are contained within block elements. Some inline elements may contain
other inline elements, but they may never contain block-level elements.<span>
tag and .note
custom class
to first header level 2 #nav
h1 {margin: 0 2em;}
pair: 0 for top and bottom, 2em for right and left margins h2 {margin: 0 2em 1em .5em;
apply to box clockwise: 0 for top, 2em for right, 1em for bottom,
.5em for left margins p {font: .75em/1.4 "Lucinda Console",Arial, Helvetica,
Verdana, sans-serif bold italics;}
img {border: 1px solid #000;}
/*comment */
<link rel="stylesheet" type="text/css" href="css/main.css">
@import
(either in style tag in head of document or
in a css document)
<style type="text/css">
@import url(css/global.css);
</style>
Universal selector: * |
0,0,0,0 |
Element: p |
0,0,0,1 |
Class and pseudo class selector:.feature a:link |
0,0,1,0 |
Id selector: #nav |
0,1,0,0 |
Inline style: <span style="color: #FFF;"> |
1,0,0,0 |
!Important
declaration - use for diagnostics, but try
not to leave in your css Tag selector in status bar
.advert
paragraph in document windowclear:both
;overflow:auto
; on content div position: relative;
with no values, forces
"has layout" context and solves many IE bugs <html>
if
none) and offset by amount from left and top* {margin:0; padding:0;}
h1, h2, h3, h4, h5, h6, p, blockquote, form, label, ul, ol, dl, fieldset,
address {
margin-bottom: 1em;
}
html, body, ul, ol, li, p, h1, h2, h3, h4, h5, h6, form, fieldset
{
margin: 0;
padding: 0;
border: 0;
}
<abbr>
and <acronym>
and cursor
style http://www.maxdesign.com.au/presentation/abbreviations/sample.htm li a {display:block;}
a
a:link
a:visited
a:hover, a:focus
a:active
<label>
tags:
<label for="name"> <input id="name" type="text" name="1n" size="12">
<fieldset>
and <legend>
to
group common form elements together and put them into context. Always with checkboxes or radio buttons. tabindex
to set the tabbing order<p>, <br />, <ol><li>
tags can be used to block label and the input element together <link href="hide_closed.css" rel="alternate
stylesheet" type="text/css" title="hide" media="all" >
ul em {}
Parent and child, adjacent siblings
div > ul {}
p + p {}
padding: 0 2px 0 1em;
@import
or <link>
before
launching.<a name="anchor">
)
you'll notice it picks up :hover and :active pseudo-classes. To avoid
this, you'll need to either use id for anchors instead, or style
with a slightly more arcane syntax: :link:hover, :link:activemedia="all"
and
for specific rules or a part of a stylesheet, enclose the rules in @media
all {}
(style rules you don't want Netscape to get go inside the
curly brackets). <style type="text/css">
@import("ie51.css");
</style>
<!--[if IE lt 6]>
<link rel="stylesheet" type="text/css" href="ie-5.0-5.5.css" />
<![endif]-->
@import
,
also add a link rel= to any style sheet, for example a print style sheet
or even an empty style sheet. This should eliminate the Flash of Unstyled
Content in IE. @import
alone for external style, sooner
or later you'll notice IE 'flashes' plain, unformatted HTML briefly
before applying CSS. Avoid with any <link rel="stylesheet" href="style.css" type="text/css" />
.
It can even be an blank css file. display: inline
<div id="wrapper">some
content
</div><!–#wrapper closing–>