Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Cascading Style Sheets questions

Options
  • 18-07-2005 6:16pm
    #1
    Registered Users Posts: 3,535 ✭✭✭


    If anyone has some model answers for these questions, no links please...I've tried loads!! :rolleyes:

    How are Style rules created and applied?

    How are Class rules created and applied?


Comments

  • Moderators, Politics Moderators Posts: 39,776 Mod ✭✭✭✭Seth Brundle




  • Registered Users Posts: 5,618 ✭✭✭Civilian_Target


    <div class="yerma">Text to format using yerma's template</div>

    (but you can also use the ID variable to apply styles)

    Then, in your stylesheet

    .yerma {font: 18px arial,sans-serif;
    color:#FF0000; font-weight:bold; text-align:justify;
    text-decoration:underline;}

    So - this example makes yerma be size 18 pixels, font arial, bright red, bold, justified and underline.

    Something like this


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    (but you can also use the ID variable to apply styles)

    Exactly - to use the ID attribute, the stylesheet entry would be:
    <div id="yerma">Text to format using yerma's template</div>
    
    #yerma {font: 18px arial,sans-serif;
    color:#FF0000; font-weight:bold; text-align:justify;
    text-decoration:underline;}
    

    Note that the hash identifies "yerma" as an element in the document, rather than a class in it's own right.

    To use the style attribute:
    <div style="font: 18px arial,sans-serif;color:#FF0000; font-weight:bold; text-align:justify;text-decoration:underline">Text to format using yerma's template</div>
    


Advertisement