Results 1 to 2 of 2

Thread: Applying style.css styles to text?????

  1. #1
    Join Date
    Apr 2008
    Posts
    11

    Applying style.css styles to text?????

    I already have a style.css with defined selectors and declarations such as
    #text font: Georgia etc.

    and

    #body font: Times New Roman.



    Now if I have text under the body category, i.e. all the text in the page, what do I have to do apart from manually using <div> codes via the coding page in dreamweaver to apply say #text to the text in question?

    I.E. how to make a css style a class from say #text in style.css?

    So how do I apply #text to selected text on the page?

  2. #2
    Join Date
    Jun 2008
    Posts
    73
    Firstly in your stylesheet the body does not need the #.

    # is used to select an element as an ID. IDs can only be used once on any given page.
    eg. <div id="main-content">BLAH BLAH</div>
    Would be selected by

    #main-content {} in your CSS.

    For the body, you just use:

    body {font-family:whatever;}

    then if you want a different font in a particular div, you specify that div only in the div using the ID method above.

    If you want to use similar styles repeatedly on a page, you would use a class. Classes are selected with a . in the css.

    <div class="blue-text">This text is blue</div>

    In your CSS would be:

    .blue-text {color:blue;}

Similar Threads

  1. styles separated by <br> or line spacing?
    By localflavor in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 10 Aug 2007, 02:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •