How do I apply a CSS to the whole page?

Discussion in 'HTML' started by OM, Sep 2, 2003.

  1. OM

    OM Guest

    It's probably really simple, but how do I apply a CSS to an entire page?
    I've only just recently learned about CSS... so I'm a bit lost.

    At the moment, I'm having to apply to every bit of text that I write.
    Can't I just add a bit of code to make the style apply to the whole document
    or something?

    Any help would be appreciated.

    Thanks.


    OM
     
    OM, Sep 2, 2003
    #1
    1. Advertising

  2. OM wrote:

    > It's probably really simple, but how do I apply a CSS to an entire page?


    Depending on what exactly you are trying to achieve, something like:

    body {
    font-family: serif;
    }

    might be what you are looking for.


    --
    David Dorward http://dorward.me.uk/
     
    David Dorward, Sep 2, 2003
    #2
    1. Advertising

  3. OM

    SeeSchloss Guest

    Well maybe you should try to find a tutorial on internet to learn more
    about css.

    Seeing what you said, I guess you using style="property:value;" in you
    tags.
    If you want to apply the tags to the whole document, you can either add
    a reference to an external stylesheet : <link rel="stylesheet"
    type="text/css" href="style.css" /> where style.css if the name of the
    file where your styles are saved (between <head> and </head>) or define
    it at the beginning of your document (but I can't tell you how to do it
    and anyway I think that external stylesheets are better).

    This way if you want for example a special formating for all your
    external links, add class="external" in your links (<a href="address"
    class="external">...</a>) and in you stylesheet, add :

    a.external
    {
    text-decoration:underline;
    other declarations;
    }

    More generally, you must define styles in the sheet this way :
    tagname.class
    {
    property:value;
    }

    I'm not sure this is well explained, I think you should search a good
    tutorial instead :)


    > It's probably really simple, but how do I apply a CSS to an entire page?
    > I've only just recently learned about CSS... so I'm a bit lost.
    >
    > At the moment, I'm having to apply to every bit of text that I write.
    > Can't I just add a bit of code to make the style apply to the whole document
    > or something?
    >
    > Any help would be appreciated.
    >
    > Thanks.
    >
    >
    > OM
     
    SeeSchloss, Sep 2, 2003
    #3
  4. OM

    Phrederik Guest

    "OM" <> wrote in message
    news:Bq85b.453$...
    > It's probably really simple, but how do I apply a CSS to an entire page?
    > I've only just recently learned about CSS... so I'm a bit lost.
    >
    > At the moment, I'm having to apply to every bit of text that I write.
    > Can't I just add a bit of code to make the style apply to the whole

    document
    > or something?


    It looks like the answers may be missing an important point.

    If you want your STYLEs to apply to the whole page put the following inside
    of your HEAD tags...

    <style>
    body { font-family: serif; }
    someattribute { someProperty: someStyleValue; someProperty:
    someStyleValue; }
    </style>

    .... and the attributes will all have their style applied on the whole page.

    You can also make a CSS file with your styles in it. The file looks the same
    as what would go inside of the STYLE tags. Then you'd add the following to
    any page that you want that style file to apply to...

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

    ....AND, if you are going to have pages for printing, you might want to make
    a custom STYLEs CSS file just for printing. Include it as:

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

    Hope this helps a bit!
     
    Phrederik, Sep 3, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MattB
    Replies:
    0
    Views:
    401
    MattB
    Aug 31, 2004
  2. Stefan Siegl
    Replies:
    1
    Views:
    964
    Marrow
    Jul 18, 2003
  3. Hari Prakash
    Replies:
    1
    Views:
    358
    Martin Honnen
    Jul 16, 2004
  4. \A_Michigan_User\
    Replies:
    2
    Views:
    898
    \A_Michigan_User\
    Aug 21, 2006
  5. Waffeloo

    Apply style changes to a whole CSS class

    Waffeloo, Sep 19, 2005, in forum: Javascript
    Replies:
    3
    Views:
    120
    Waffeloo
    Sep 20, 2005
Loading...

Share This Page