Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

new image q

Options
  • 11-01-2011 1:45pm
    #1
    Registered Users Posts: 287 ✭✭


    hi

    i figured out how to ad a border to image using css which is fine - just wonder if you can add a border to some images but not all images

    thanks for the help


Comments

  • Closed Accounts Posts: 9,700 ✭✭✭tricky D


    Give them a different class

    css
    img.noborder {border: 0px;}
    img.border {border: 1px #888 solid;}
    

    xhtml
    <img src="image.jpg" class="noborder" /><!-- ain't got no border -->
    
    <img src="image.jpg" class="border" /><!-- has got a border -->
    


  • Registered Users Posts: 1,801 ✭✭✭cormee


    Assign a class to each individual image instead of assigning styles to the <img> tag itself.

    ie. Your code is currently

    html:

    <img src="...">

    CSS:

    img {
    border: thin solid #999999;
    }

    Everytime you insert any image the styles you specified are applied to it.

    Instead assign a class to the image

    <img src="1.jpg" class="border">
    <img src="2.jpg">

    CSS:

    .border {
    border: thin solid #999999;
    }

    Image 1 will have a border, image 2 won't.


Advertisement