SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Thread: html block css

  1. #1
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face html block css

    Is there a way to block css being used for a certain part of html on a page.

    mary

  2. #2
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,449
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Use a DIV:

    <div id="whatever">
    Put content here.
    </div>

  3. #3
    SitePoint Wizard silver trophybronze trophy Nadia P's Avatar
    Join Date
    Oct 2004
    Location
    NSW Australia
    Posts
    3,564
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd love to know what the question actually means ;-)

    Nadia

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Mary, and welcome to SitePoint!

    No, there is no way to block or disable CSS for parts of a page. There are two ways to work around it, though:
    1. Enclose the part in a DIV with an id attribute, as stymiee said. Then apply CSS rules to it that cancels the rules you wish not to apply.
    2. Use classes and IDs for everything but the special part, and apply CSS rules only to those classes and IDs.
    Birnam wood is come to Dunsinane

  5. #5
    CTO htmlguy's Avatar
    Join Date
    Feb 2005
    Location
    North Carolina
    Posts
    420
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yea, or if you applied body styles in css, put the stuff you don't want formatted in css in a special div, which you choose the defaults or the look of that div.
    HTMLGuy

  6. #6
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face thanks +

    Thanks for your reply. And Thanks to all other replies.

    Is there an easy way to set css defaults or do you have to list all attributes and set them.

    mary


    Quote Originally Posted by htmlguy
    Yea, or if you applied body styles in css, put the stuff you don't want formatted in css in a special div, which you choose the defaults or the look of that div.
    HTMLGuy

  7. #7
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking

    Thank you
    mary


    Quote Originally Posted by AutisticCuckoo
    Hi Mary, and welcome to SitePoint!

    No, there is no way to block or disable CSS for parts of a page. There are two ways to work around it, though:
    1. Enclose the part in a DIV with an id attribute, as stymiee said. Then apply CSS rules to it that cancels the rules you wish not to apply.
    2. Use classes and IDs for everything but the special part, and apply CSS rules only to those classes and IDs.

  8. #8
    CTO htmlguy's Avatar
    Join Date
    Feb 2005
    Location
    North Carolina
    Posts
    420
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well for browser defaults just do this:
    body (or #divid) {
    }

    Basically that makes no changes to the default of the body, or the browser.
    HTMLGuy

  9. #9
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by catchit2000
    Is there an easy way to set css defaults or do you have to list all attributes and set them.
    There is no easy way to 'undo' CSS set by another rule, unfortunately.

    Off Topic:

    BTW, it's called properties, not 'attributes' in CSS.
    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
  •