Syntax: style-name {property: value;}
External Style Sheets - 2 methods for linking styesheets:
link: <link rel="stylesheet" type="text/css" href="style.css" />
import: <style type="text/css">@import("style.css") </style>
Styles Located in Page (place in head tag)
<style type="text/css">
style-name { property: value; }
(more styles)
</style>
Inline CSS Styles as HTML Attributes: <htmlTag style="property: value">
CSS Comment /* This is a comment */
Pseudo Selectors For hover text effects: (use this specific order)
a:link
a:active a:visited
Followed by the hover selector:
a:hover
CSS Hover Example:
a:link,a:active,a:visited{ color:#000000; text-decoration:none;}
a:hover{color:#0000FF;text-decoration:underline;}
position:
static - default inline
relative - in relation to its container
absolute- can be positioned anywhere
z-index: in absolute positioning, an element can overlap another. Default is 0. Top in Firefox is 999
left: X position (pixels from the left relative to its container) of the left border of an element
top The y position (pixels to the top relative to its container) of the top of an element
clear: Starts a newline where specified.
both | left | right | none;
float: Floats box to a specified side of preceding container :
left | right | none
Lists are commonly used as horizontal menus by using the attribute list-style:none; and float:left; for the <li> tags
class: name preceded by a period - use for recurring styles
CSS Class Example: .feature-headline{ font-weight:bolder; font-size:1.5em; }
id:
name preceded by a hash (#) mark - single instance per page
CSS ID Example: #page-headline{ font-weight:800; font-size:2.5em; }
display: (full browser compatiblity only)
block - holds width and height;
inline-formats text;
none - hides element removes height and width.
visibility: visible | hidden (still holds width and height)
Illustrating differences between IE and W3C measurements.
Workarounds can involve conditional code placed after regular css like so:
<!--[if IE]>
width:80%; margin:3px;
<![endif]-->