Setting Up CSS in HTML

CSS is a style sheet language used to define the appearance and formatting of a document written in a markup language — often HTML. A style in this sense is a set of text-formatting instructions, such as font, color, size, and so on. Because CSS instructions exist separately from HTML code, you can apply the same set of instructions to every page in your website, or to more than one website. Here's a list of common HTML instructions used in conjunction with CSS:



  • To link within HTML to an external style sheet, use the following structure:


    <head>
    <link rel="stylesheet" type="text/css" href="stylesheet.css" />
    </head>


  • To embed styles within an HTML page:


    <style type="text/css">
    styles ...
    </style>


  • Using a body style to design the overall page:


    body {
    margin:0;
    padding:8px 4px 12px 4px;
    color:#ffbf11;
    background:#000000 url(images/space.gif);
    }


  • To use a class selector in HTML:


    <p class="caption">This is a caption paragraph</p>


  • To use an ID selector in HTML:


    <div id="sidemenu"> ...menu links... </div>


  • Common type selectors:


    body {...}
    p {...}
    td {...}
    ul {...}


  • Common class selectors:


    .caption {...}
    .banner {...}
    .main {...}


  • Common ID selectors:



    #mainParagraph {...}
    #sidemenu {...}
    #footer {...}



dummies

Source:http://www.dummies.com/how-to/content/setting-up-css-in-html.html

No comments:

Post a Comment