| Cascading StyleSheet Information, pg. 1 | ||
|---|---|---|
|
Cascading StyleSheets is used to style HTML, XHTML, and XML webpages. It allows you greater control over page and text layout and gives you the ability to alter a design by only altering one file. You can use as many declarations as you want on a single selector. To add comments to your stylesheet (.css) file, use /*...*/. Formatting for inline styles (in the body of the webpage): <p style="color:blue;"> p is the selector; color is the property; and blue is the declaration color:blue; is the property of this paragraph tag (the text color is made blue) Formatting for embedded styles and external stylesheets: p {color:blue;} Nearly the same as above, but the selector isn't written as an HTML tag. The differences between style types:
|
Designing with CSS usually involves the use of <div> tags, which are referred to as layers. Layers can be arranged on the webpage just about any way you want. You can also arrange images, lists, and paragraphs similar to the way you arrange layers (the rules for paragraphs are nearly identical, except for the fact that you can't nest them). All of these are called elements. By default, layers span 100% of the webpage width. The layout is controlled by the inline model (text) and the box model (everything else). Most of the time the inline model's rules can be ignored. Internet Explorer (especially versions before 7.0) doesn't obey the box model's rules. ![]() The content area is the space in the layer where text, images, etc. will go. The padding is beyond this area so it's separate from the height and width of the content area and can make things appear larger than you want them to look if not taken into account when setting these properties. The border surrounds the padding and the content area. The margin is the space outside of everything else that's between elements. Elements that are controlled by the box model are called block-level elements. Text elements are called inline elements. Commonly used units in CSS:
|
|