SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Sep 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Over-ride general tag formatting

    Hi a bit of a css noob here, I have a wordpress site, and the theme has a css file that places a border around all the images in the posts

    .entry img{
    border:1px solid #333;


    I have a page where I need to get rid of all borders around the images.

    what's the best way to do it?


    Cheers

  2. #2
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,816
    Mentioned
    34 Post(s)
    Tagged
    2 Thread(s)
    w/o know more about your specific situation (code) this might be a little difficult to answer.

    Suggestions off the top of my mind and assuming you want to get rid the borders in ALL the images thought that specific page , but not in any other page.

    1) Find the link to your CSS style sheet file on your header.php file
    2) AFTER that LINE insert a conditional PHP statement that determines if that is the page you want to change.
    3) if it is so, then have the PHP output the followingstyle> .entry img{border:none;}</style>. You can add any other overrides to your general styles you want, between the style tags.

    Another method is :
    1) in the header.php file, use PHP to add a pageID_? to your body tag
    2) Find the link to your CSS style sheet file
    3) After insert into the HTML <style> #pageID_(whatever the page ID is for the page you want to alter) .entry img{border:none;} </style>


    If you dont like dealing with PHP, consider if it might be simpler to get rid of all borders through your entire site, and then just apply the borders to the specific images you want.

    If this is the case, you can just go into your style sheet:
    get rid of {border:1px solid #333;} on .entry img, and add .entry .bord{border:1px solid #333}. but now you'll have to remember to add class ="bord" to any image tag you want to have a border when you enter it in your CMS

  3. #3
    SitePoint Member
    Join Date
    Sep 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi dresden_phoenix

    Thanks for the carefully thought out answer. I'm not a programmer so dealing with php sounds a bit daunting to me.

    The border looks good on the rest of the site.

    however I've got a little comparison table where i have small images 25px wide, that looks silly when each one of them has a border around it. Is there a css entry I could put on which says all images in tables should be border=none, or something?

  4. #4
    SitePoint Member
    Join Date
    Sep 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    actually, I kinda fluked it..

    I added

    .entry td img{
    border:0px solid #333;
    }

    after it and it seems to work..

  5. #5
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Yes, you can do that
    .entry table img { border: none; } It would be even better if that table had a class or id.
    Ryan B | My Blog | Twitter


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
  •