SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Evangelist BJ Duncan's Avatar
    Join Date
    Jun 2007
    Location
    Bowen Mountain, NSW
    Posts
    490
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how do I take css out of a particular section?

    G'day to all,

    I was wondering, is there a way of being able to create a site that has css all over it, but then in say 1 <div> tag, take out all css features that run throughout the site?

    I guess similar to that of frames (but of course I don't want to use frames).

    Many thanks in advance,
    Regards,
    BJ Duncan

  2. #2
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't quite understand what you're asking here. Are you asking about inlined styles?

  3. #3
    SitePoint Wizard bronze trophy Centauri's Avatar
    Join Date
    May 2007
    Location
    Newcastle, Australia
    Posts
    3,718
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You would give that div an id or class, then over-ride any css styles it would normally inherit with your desired styling.

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The easiest way would be to do what Centauri said: override the CSS for that particular DIV.

    The alternative is to use classes for everything except that DIV and style those classes. That would lead to bloated and messy markup, though.
    Birnam wood is come to Dunsinane

  5. #5
    SitePoint Zealot
    Join Date
    Feb 2008
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you gave that div an id of nostyle and didn't reference it in the CSS would it still inherit any styles?

  6. #6
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any CSS rules specified for unadorned type selectors would still apply. For instance, if you specify a rule like
    Code:
    p {color:red}
    it will apply to paragraphs within a DIV with id="nostyle".

    If CSS3 were fully supported you could prefix every rule with *:not(#nostyle) and a space, but that will only work in Firefox and Safari at the moment.
    Birnam wood is come to Dunsinane

  7. #7
    SitePoint Evangelist BJ Duncan's Avatar
    Join Date
    Jun 2007
    Location
    Bowen Mountain, NSW
    Posts
    490
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey guys,

    Thanks for the feedback. My query is basically that of can I have only a particular section of the page that does not conform with the css style sheet and have that particular section conform to the default style.

    Out of the responses I take it that it appears it is on the agenda of css3.

    Many thanks for everyones help.

    Cheers
    Regards,
    BJ Duncan

  8. #8
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BJ Duncan View Post
    My query is basically that of can I have only a particular section of the page that does not conform with the css style sheet and have that particular section conform to the default style.
    Not without some work, no.
    Birnam wood is come to Dunsinane


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
  •