March 27, 2012

how to create a multiple border on a img?

Question by Rohit Azad

images link http://imageshack.us/photo/my-images/31/multiplebg.jpg/

Hello fri i want to used one image. I want to multiple border in single image is possible throw css

Answer by Kyle Sevenoaks

At the moment it’s not possible to make more than one border in CSS. You can kind of fake having three borders by using some clever css3 shadowing techniques.

div
{
    margin: 10px;
    border: 2px solid #f00;
    box-shadow:inset 0px 0px 2px 2px #0f0, 0px 0px 2px 5px #00f;
}

But I’d just go with adding the borders to the image as this isn’t supported by IE. (Maybe IE9 supports it.)

Answer by Starx

Nest your <img> inside multiple container and apply border to each

<div id="b1">

    <div id="b2">

        <div id="b3">
            <img src="" />
        </div> 

    </div> 

</div> 

Then apply border to each like

#b1 { border: 1px #000 solid; }
#b2 { border: 1px #f00 solid; }
#b3 { border: 1px #0f0 solid; }
img { border: 1px #00f solid; }

Or

Use a image that has multiple border on it and using border-image property

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!