CSS Cheat Sheet

Reviews
Shared by: armani11
Stats
views:
115
rating:
not rated
reviews:
0
posted:
11/9/2008
language:
pages:
0
CSS Cheat Sheet What is CSS? • • • • • • • CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles are normally stored in Style Sheets Styles were added to HTML 4.0 to solve problems External Style Sheets can save you a lot of work External Style Sheets are stored in CSS files Multiple style definitions will cascade into one [1] h1,h2,h3 { font-family: veranda, arial, ‘sans serif’; } p,table, li { font-family: veranda, arial, ‘sans serif’; margin-left: 10pt; } Code Example 1 CSS Solves Style Problems HTML tags were originally designed to define the content of a document. They were supposed to say "This is a header", "This is a paragraph", "This is a table", by using tags like

,

,

, and so on. The layout of the document was supposed to be taken care of by the browser, without using any formatting tags [1]. As Netscape and Internet Explorer continue to add new HTML tags and attributes (like the tag and the color attribute) to the original HTML specification, it became more and more difficult to create Web sites where the content of HTML documents was clearly separated from the document's presentation layout [1]. HTML Tags

Make a new paragraph

Make a table
  • Make a List of items To solve this problem, the World Wide Web Consortium (W3C) - A non profit, standard setting consortium, responsible for standardizing HTML - created STYLES in addition to HTML 4.0 [1]. The Code Example 1 shows that you can change the header tags in HTML to always have a consistent font family attribute. This font family is set to veranda, arial, and sans serif. You may list as many tags as you would like before declaring what attributes are tied to the tags. The second part of the listing shows the tags

    ,

  • and
  • all have the set font family and a margin to the left. Save Yourself Time Style sheets do the same as the font and color tag attributes. Style sheets are the new standard that HTML should be using. By using CSS you can easily change the look and style of your entire website by just changing a few lines in the CSS. If CSS were not used, in order to change the look of your website you would have to go through all the HTML code and change every place where fonts, colors, or any other formatting edits are found. CSS is powerful when developing websites because you can control the style and layout of multiple pages all at once. Another powerful use of CSS is that you can use them internally and externally to a website. Internal CSS can be used internally in an HTML document. Code Example 2 shows the use of CSS internally. External CSS can also be used externally in a HTML document. Code Example 3 shows the use of CSS externally. How Cascading Style Sheets Work If you declare more than one style for an eleCode Example 2 ment then CSS applies its precedence procedure for the styles. The order of precedence for CSS is: 2. External Style Sheet 3. Internal Style Sheet (inside the tag) Code Example 3 4. Inline Style (inside an HTML element) The Inline Style has the highest precedence so the style declared will override any of the other styles that may or may not be defined. HTML FORM

    This is a paragraph.

    This is a paragraph.

    This is a paragraph.

  • ab
    cd
    Code Example 4 Figure 1 [1] W3Schools, HTML Basic, “HTML Forms,” 2006. [Online]. Available: http:// www.w3schools.com/html/html_forms. asp [Accessed: Nov. 6, 2006]. [2] Web Design Group, “CSS Structure and Rules,” 2006. [Online]. Available: http:// www.htmlhelp.com/reference/css/ structure.html [Accessed: Nov. 6, 2006].


    Related docs
    CSS Cheat Sheet
    Views: 281  |  Downloads: 61
    The Complete CSS Cheat Sheet
    Views: 1103  |  Downloads: 157
    CSS Cheat Sheet
    Views: 100  |  Downloads: 9
    CSS Cheat Sheet
    Views: 50  |  Downloads: 8
    CSS - Designer Cheat Sheet
    Views: 488  |  Downloads: 24
    CSS Cheat Sheet
    Views: 25  |  Downloads: 0
    CSS Cheat Sheet
    Views: 54  |  Downloads: 15
    CSS Cheat Sheet
    Views: 47  |  Downloads: 3
    CSS Cheat Sheet
    Views: 30  |  Downloads: 12
    CSS Cheat Sheet
    Views: 35  |  Downloads: 6
    CSS Cheat Sheet
    Views: 5  |  Downloads: 1
    css cheat sheet v2
    Views: 26  |  Downloads: 1
    premium docs
    Other docs by armani11
    Non-Discrimination Policy
    Views: 718  |  Downloads: 15
    The Doctrine and Practice of Yoga
    Views: 295  |  Downloads: 13
    CorpDocs- Board Resolution Setting Record Date
    Views: 190  |  Downloads: 2
    ASSIGNMENT OF COPYRIGHTS
    Views: 325  |  Downloads: 10
    Schedule D (Form 1040) Capital Gains and Losses
    Views: 7101  |  Downloads: 20
    ASSIGNMENT OF MONEY DUE
    Views: 275  |  Downloads: 2
    Gilead Sciences Inc Ammendments and Bylaws
    Views: 172  |  Downloads: 0