View Full Version : Padding around an image for the border
spadez
03-19-2008, 08:11 PM
I need a bit of help. What i want is my image, and then a 5 px gap around the image, and then the border. So instead of the image border touching the image, there is a 5px spacer inbetween.
I used this code:
<img style="padding: 5px; border: 1px solid #000000;" src="http://img528.imageshack.us/img528/4149/100nw3.png">
But it doesnt seem to register the padding part, so the border is right up against the image.
Can someone tell me where im going wrong?
James
VIPStephan
03-19-2008, 08:13 PM
Should work, actually. Can you show us your entire code please?
spadez
03-19-2008, 08:22 PM
Even when i put just that code into notepad and save it as a html it doesnt work though.
Here is my test.html:
<img style="padding: 5px; border: 1px solid #000000;" src="http://img528.imageshack.us/img528/4149/100nw3.png">
jerry62704
03-19-2008, 08:25 PM
That isn't test html. It's a small part of a test.html page. HTML, HEAD, BODY (in lower case of course) tags are needed. And a DOCTYPE if you want to avoid other problems.
spadez
03-19-2008, 08:33 PM
<html>
<head>
</head>
<body>
<img style="padding: 5px; border: 1px solid #000000;" src="http://img528.imageshack.us/img528/4149/100nw3.png">
</body>
</html>
Still the same problem.
maxvee8
03-19-2008, 08:42 PM
that works for me a 5 px space and then the border!
spadez
03-19-2008, 09:26 PM
Why isnt it working for me then! :(
Im using Internet Explorer 6, is there a chance that is the reason. On the attached picture the left is how i see it and the right is how i want it.
effpeetee
03-19-2008, 10:21 PM
It worked when I added a xhtml transitional doctype
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
Frank
spadez
03-19-2008, 10:45 PM
Ah now it works! Thank you.
+rep
VIPStephan
03-20-2008, 08:56 AM
See? That’s why I asked you for your complete and entire code, not just one HTML element. :rolleyes: Help us to help you and you’ll get help much more quickly.
And there are many more things to consider when building a website. Just adding a doctype without knowing why and what it does isn’t helping you very much in future.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.