border html help

  FOEYDO 17:26 26 Jan 2008
Locked

Hi, I want to put a border with a darker border round the edge can u tell me how to do this in a style sheet? Border round an image

  Kemistri 21:31 26 Jan 2008

If you wanted both lines to be the same in colour and width, you would just use the "border" shorthand with the "double" value:

img {
border:double 1px #000;
}

But since you want two different lines, either add one to the image itself and then add a single border, or add a double border to the image and don't use the declaration at all. The lazy man's approach would be two nest a div within another div and border each one, specifying dimensions for the inner div, with padding to match your desired line spacing, but that isn't the most reliable and consistent way in light of padding variances and why have more code than necessary?

  Eric10 21:31 26 Jan 2008

To put a 3px dark grey border round all images use:

img { border: 3px solid #444444; }

in your stylesheet, but if you only want to put the border round some images and not others then define a class as:

.img1 { border: 3px solid #444444; }

then call it with <img class="img1" src="your_image.jpg">

  Kemistri 21:32 26 Jan 2008

For 1px, use a larger value, like maybe 10px or whatever works for you. Force of habit at work there, as I don't use double borders!

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

WPA2 Hack Latest News: How Secure is your Wi-Fi?

Photoshop CC 2018 released with new Curvature Pen and better brush tools

Best kids apps for iPhone & iPad

Comment utiliser Twitter ?