|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Don't know whether anyone might be willing to take a look at a little
CSS problem that's stumping me. There's a page fragment at: http://www.weatherstations.co.uk/default_test.htm and the item giving the problem is the clouds image (which has deliberately been duplicated as a further check.) The question is why there seems to be a bottom margin of white space to the clouds image (in IE7 and FF2.0.12 at least) when AFAICS all the relevant margins, padding etc are set to zero in the stylesheet. I'd like to try to understand what's generating this specific problem if anyone can offer an explanation please. JGD |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On 2008-03-30, John Dann <news@prodata.co.uk> wrote:
> Don't know whether anyone might be willing to take a look at a little > CSS problem that's stumping me. There's a page fragment at: > > http://www.weatherstations.co.uk/default_test.htm > > and the item giving the problem is the clouds image (which has > deliberately been duplicated as a further check.) > > The question is why there seems to be a bottom margin of white space > to the clouds image (in IE7 and FF2.0.12 at least) when AFAICS all > the relevant margins, padding etc are set to zero in the stylesheet. > > I'd like to try to understand what's generating this specific problem > if anyone can offer an explanation please. It's because imgs are display: inline, so they sit on the baseline like text, with a bit of space below them for descenders. Make the img display: block. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Ben C wrote:
> On 2008-03-30, John Dann <news@prodata.co.uk> wrote: >> Don't know whether anyone might be willing to take a look at a little >> CSS problem that's stumping me. There's a page fragment at: >> >> http://www.weatherstations.co.uk/default_test.htm >> >> and the item giving the problem is the clouds image (which has >> deliberately been duplicated as a further check.) >> >> The question is why there seems to be a bottom margin of white space >> to the clouds image (in IE7 and FF2.0.12 at least) when AFAICS all >> the relevant margins, padding etc are set to zero in the stylesheet. >> >> I'd like to try to understand what's generating this specific problem >> if anyone can offer an explanation please. > > It's because imgs are display: inline, so they sit on the baseline like > text, with a bit of space below them for descenders. > > Make the img display: block. Or make the img vertical-align:bottom; -- Gus |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Many thanks for the answers.
On Sun, 30 Mar 2008 15:12:55 -0400, Gus Richter <gusrichter@netscape.net> wrote: > >Or make the img vertical-align:bottom; Seems to work for FF2 but not for IE7 AFAICS. JGD |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Sun, 30 Mar 2008 21:40:21 +0100, John Dann <news@prodata.co.uk>
wrote: >Seems to work for FF2 but not for IE7 AFAICS. > Whoops - too quick off the mark! It worked immediately on a page refresh in FF2, but not immediately in IE7. But when I closed IE7 fully and reopened it then it did work. Is the cache for the CSS file more persistent in IE7 than the cache for the html file? |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
On Sun, 30 Mar 2008 15:12:55 -0400, Gus Richter
<gusrichter@netscape.net> wrote: >Or make the img vertical-align:bottom; Just as a follow-up point here: This solution works OK but I'm slightly surprised that an equivalent space doesn't then appear at the top of the box (ie what one might think of as an ascender space). It's as if by using vertical-align:bottom then the bounding box is actually made shorter (ie less tall) and not simply that the img is bottom-aligned rather than top-aligned. Is this just how the browser engines are designed to work, ie the process is not symmetrical top-to-bottom? |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
On 2008-03-31, John Dann <news@prodata.co.uk> wrote:
> On Sun, 30 Mar 2008 15:12:55 -0400, Gus Richter ><gusrichter@netscape.net> wrote: > >>Or make the img vertical-align:bottom; > > Just as a follow-up point here: > > This solution works OK but I'm slightly surprised that an equivalent > space doesn't then appear at the top of the box (ie what one might > think of as an ascender space). It's as if by using > vertical-align:bottom then the bounding box is actually made shorter > (ie less tall) and not simply that the img is bottom-aligned rather > than top-aligned. That's exactly what happens. > Is this just how the browser engines are designed to work, ie the > process is not symmetrical top-to-bottom? It is all in the CSS 2.1 specification but it's a bit of a nightmare. That's why I suggested display: block. It also expresses more clearly what you want since in your example there is no text nearby, you just want the imgs to display like blocks. |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
..oO(John Dann)
>Whoops - too quick off the mark! It worked immediately on a page >refresh in FF2, but not immediately in IE7. But when I closed IE7 >fully and reopened it then it did work. Is the cache for the CSS file >more persistent in IE7 than the cache for the html file? Sometimes you have to force IE to really reload all external resources. A simple ctrl-r doesn't work always, sometimes you have to press ctrl and hit the refresh button in the toolbar. At least it worked this way in IE 6. Micha |
|
![]() |
| Outils de la discussion | |
|
|