Forum Moderators: not2easy
Here is the code:
* {
margin: 0;
padding: 0;
}
The problem is that hspace and vspace won't work for images in firefox (the zero'ed out margin nullifies these image attributes).
Is there a way I can block inheritance just for img's?
So something like:
* {
margin: 0;
padding: 0;
}
* img {
margin: none; //which of course doesn't work
}
Any ideas on how I can get hspace and vspace working again, while retaining the zero'ing out styles?
Probably something like: img {margin: x y}
See [webmasterworld.com...]
[edited by: Wlauzon at 5:17 pm (utc) on June 3, 2008]
So I could certainly set say
* img {margin-left:5px;margin-right:5px }
to emulate a hspace value, but the problem is this style would set that margin for each and every img for every page on my website. I want to be able to control the hspace for each separate tag using the hspace attribute and this works fine in firefox if I get rid of
* {
margin: 0;
padding: 0;
}
However I can't do that because other parts of my template are depending on this.
What I need is for everything to have 0 margin and 0 padding except for img's.
Is this possible?
I could create a class for each image that has a different hspace, but this would be awkward because there are so many images and I would have to set the class to each and every image.
The preferable solution would be to fix something in the master stylesheet but I'm not sure how to do this. If I get rid of * {margin:0px;} this will cause my template to look all funky.
You'll have to do a more complicated reset, e.g.:
html,
body,
div,
p,
h1,
h2,
h3,
h4,
h5,
h6,
address,
blockquote,
ul,
ol,
dl { margin: 0;
padding: 0; } ... that sort of thing. I think Eric Meyer has a pretty... advanced reset.css, which you could just remove the instances of
img
Well it did do the trick. If anybody has a similar problem (especially with drupal templates) just replace
* {
margin: 0;
padding: 0;
}
with:
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin:0px;
padding:0px;
}
Thanks for the tip Setek about reset.css which looks pretty nifty for future reference: [meyerweb.com...]