Press → key to advance.
element { attribute: value; }
element child { attribute: value; }
ul li { padding: 5px; }
#topnav ul { list-style: none; }
Any 'block' element, p, img, table, etc.
<p style="border:1px solid red; padding:5px; color:blue;">Visible text</p>
Visible text
<div id="topnav">
#topnav { attributes }
IDs must be unique.
<p class="alert">
p.alert { attributes }
<a href="#">
Anchors have four pseudo-classes:
a:link | a:visited | a:hover | a:active
Define them in that order.
a:link, a:visited { attributes }
a:hover, a:active { attributes }
First, consider your structure:
Example
Have a design in mind, don't build blindly!
#container
{
width: 760px;
border: 1px solid red;
margin: 50px;
margin-left: auto;
margin-right: auto;
padding: 20px;
background: #666;
}
Styles can be embedded in the html page itself or linked via a command in the header.
<style> p { color:red } </style>
<link rel='stylesheet' href='url' type='text/css' media='all' />
Embedded stylesheets LIMIT what the CSS affects.
Linked stylesheets can affect MANY pages.
<p style="color:red; font-weight:900; padding:5px; border:3px solid #000; width:40%; margin-left:auto; margin-right:auto;">Visible text.</p>
Visible text.
DIVs are DIVisions of a page.
Containers. BOXES. They are the structure of your page.
The goal of a reset stylesheet is to reduce browser inconsistencies in things like default line heights, margins and font sizes of headings, and so on.
Eric A. Meyer is one of the most-often referenced CSS experts.
Using an example from maxdesign.com let's walk through building a CSS layout.
Russ Weakley is a 20-year veteran of design, much of it on the web.
See you Thursday night!