Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Cascading Style Sheets questions

  • 18-07-2005 06:16PM
    #1
    Registered Users, Registered Users 2 Posts: 4,020 ✭✭✭


    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, Paid Member Posts: 44,211 Mod ✭✭✭✭Seth Brundle




  • Registered Users, Registered Users 2 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, Registered Users 2 Posts: 21,278 ✭✭✭✭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