Click to See Complete Forum and Search --> : padding an element
Nulrick
10-24-2003, 02:37 PM
how exactly do you right out a div style for padding the top and bottom of an image and separately the style for padding the left and right value?
I want to apply it so some but not all images in my HTML page, so it will either have to be written locally around each image or as a style which I would have to refer to using a div tag.
Khalid Ali
10-24-2003, 03:20 PM
you can write 2 separate classes of style and use them appropriately for images
Nulrick
10-25-2003, 12:10 PM
The reason I am writing my question is because I wrote out the style and it is not working. I'm trying to troubleshoot to see if I'm not writing it out correectly or if padding doesn't work w/ images. Do you know how exactly to write it out?
thanks!
DaveSW
10-25-2003, 02:46 PM
<style type="text/css">
<!--
div {
padding-left: 15px;
padding-right: 15px;
padding-top: 10px;
padding-bottom: 10px;
}
-->
</style>
any help?
DaveSW
10-25-2003, 02:47 PM
rereading your question you should probably apply that to the image.
<style type="text/css">
<!--
div img {
padding-left: 15px;
padding-right: 15px;
padding-top: 10px;
padding-bottom: 10px;
}
-->
</style>
This one will only apply to images which are within a div.
Lotus
10-25-2003, 02:49 PM
Hmm... I just don't get why people keep adding <!-- --> tags around their styles. It's only needed for some of the very few people left using older versions of Netscape... Opera and Internet Explorer all run the styles perfectly without those tags.
DaveSW
10-25-2003, 02:54 PM
Originally posted by Lotus
Hmm... I just don't get why people keep adding <!-- --> tags around their styles. It's only needed for some of the very few people left using older versions of Netscape... Opera and Internet Explorer all run the styles perfectly without those tags.
It's not exactly a difficult thing to do is it? And at least you're left with an accessible page, which lets face it, is pretty much the point of css...
I had a machine with IE 5.something which would hang for ages without the comment tags.