Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

new image q

  • 11-01-2011 01:45PM
    #1
    Registered Users, Registered Users 2 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,698 ✭✭✭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, Registered Users 2 Posts: 1,802 ✭✭✭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