SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Sep 2004
    Location
    Reykjavík
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Disable CSS in a tag

    Hi,

    My CSS style sheet has this style attached to all IMG tags:

    HTML Code:
    margin:0 0 5px 0;
    padding:4px;
    border:1px solid #ccc;
    I wish to disable this for invidual images. Is that possible without removing this from the CSS document? Sorry about my limited CSS knowledge.
    Sincerely,
    Friđrik Már Jónsson

  2. #2
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can reference individual images by their surrounding div tags as such:

    <div id='top'>
    <img src='something.jpg'>
    </div>

    then the css for that image only would be

    div#top img {
    border: none;
    }

    or you can set a class for the image you want to have borders (or not) and then directly set the properties like this

    <img class='no-border' src='something.jpg'>

    then the css would be

    img.no-border {
    border: none;
    }

    or just

    .no-border {
    border: none;
    }

    Im 99% sure these will handle just about anything you need

  3. #3
    SitePoint Member
    Join Date
    Sep 2004
    Location
    Reykjavík
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I used the...

    HTML Code:
     img.no-border {
       border: none; 
      }
    ... and ...

    HTML Code:
    <IMG SRC="image.jpg" CLASS="no-border">
    ... and it worked completely out for me. Thanks alot mate. Added to reputation.
    Sincerely,
    Friđrik Már Jónsson

  4. #4
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Glad I could help


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
  •