SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2009
    Location
    A small village called Aunsby,Lincolnshire,U K
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS stylesheet affecting several webpages

    Greetings

    I understand that the stylesheet contents will affect all or any of the site's web pages.

    How do I change fonts, colors, borders, padding etc. in second and subsequent pages to exclude settings in CSS which will affect the first page ?

    I bet you know!

    Regards Monty

  2. #2
    SitePoint Enthusiast thomasfrank09's Avatar
    Join Date
    Jun 2009
    Location
    Ames, IA
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If all you want to edit is the first page, use an embedded style sheet that will edit the original parameters set in the external one.
    I run the blog College Info Geek.

    You can find me at:
    My personal site | Facebook | Twitter | LinkedIn

  3. #3
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Monty,

    Just create a series of different CSS classes and then use them as you want on the pages that need different styles. As a basic example, if you had this in your CSS file that was shared across two pages:

    h1.page1 {
    font-size: 14px;
    }

    h1.page2 {
    font-size: 12px;
    }

    On page 1, you would do something like this:

    <h1 class="page1">A heading on page1</h1>

    And, on page 2, like this:

    <h1 class="page2">A heading on page2</h1>

    Page 1's H1 would be in 14px, Page 2 would be in 12.

  4. #4
    SitePoint Zealot
    Join Date
    Jun 2009
    Location
    Ottawa, Ontario, Canada
    Posts
    120
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    An external style sheet will only affect the pages that call it. Simply placing a style sheet on your server will not automatically cause it to work with your pages.

    One simple approach is to have different style sheets for different pages. For example, you might have a file main.css for most of your pages and a file photo.css for photography page.

    Even when you have called an external stylesheet you can still redefine the CSS rules for specific elements by calling another external style sheet afterward. Another option is to rewrite some of the CSS rules within your file.

    The other approaches described above will work too. It is handy to have all of your CSS rules organized in a small number of files.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jun 2009
    Location
    A small village called Aunsby,Lincolnshire,U K
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi webopius

    many thanks for your excellent information

    regards monty

  6. #6
    SitePoint Enthusiast
    Join Date
    Jun 2009
    Location
    A small village called Aunsby,Lincolnshire,U K
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi floater

    Very grateful for your welcome advice

    Regards Monty

  7. #7
    SitePoint Enthusiast
    Join Date
    Jun 2009
    Location
    A small village called Aunsby,Lincolnshire,U K
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi thomasfrank09

    Many thanks for your suggestions

    Regards Monty


Bookmarks

Posting Permissions

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