CSS Summary |
||||
44 views
CSS (Cascading style sheets) are used to separate content from presentation. CSS describe the presentation of a document written most of the times in HTML. CSS is used to define colors, fonts and layout. A style sheet file consists of a list of rules. declaration block (a list of semicolon-separated declarations in curly braces) <>In CSS, selectors are used to declare which elements a style applies to, a kind of match expression. Here are some examples of selector syntax: <> Descendants: e.g. for a elements that are descendants of li elements (e.g links inside lists) the selector is li a. Class or id attributes: e.g. .class and/or #id for elements with class=”class” or id=”id”. <>Adjacent elements: e.g. for all p elements preceded by h2 elements, the selector would be h2 + p. By attribute: e.g. for all <input type=”text”> the selector would be input[type="text"]. <> Each declaration consists of a property, a colon : and a value. Example: p { font-family: “Arial”erif; } h2 { font-size: 50%; color: green; background: white; To use a CSS style sheet created a file with the sytle sheet file with the rules and link it or import it using: <link rel=”stylesheet” href=”text.css” type=”text/css” > |
| « CSS Media Type | span and div tag. » |
| Posted on Saturday, June 28th, 2008 at 11:12 am under CSS Advanced | RSS 2.0 Feed | |