PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.info.authoring.CSS > Img - bottom margin mystery
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Img - bottom margin mystery

Réponse
 
LinkBack Outils de la discussion
Vieux 30/03/2008, 17h52   #1
John Dann
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Img - bottom margin mystery

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
  Réponse avec citation
Vieux 30/03/2008, 18h14   #2
Ben C
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Img - bottom margin mystery

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.
  Réponse avec citation
Vieux 30/03/2008, 20h12   #3
Gus Richter
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Img - bottom margin mystery

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
  Réponse avec citation
Vieux 30/03/2008, 21h40   #4
John Dann
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Img - bottom margin mystery

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
  Réponse avec citation
Vieux 30/03/2008, 21h47   #5
John Dann
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Img - bottom margin mystery

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?
  Réponse avec citation
Vieux 31/03/2008, 10h20   #6
John Dann
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Img - bottom margin mystery

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?
  Réponse avec citation
Vieux 31/03/2008, 11h18   #7
Ben C
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Img - bottom margin mystery

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.
  Réponse avec citation
Vieux 31/03/2008, 13h06   #8
Michael Fesser
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Img - bottom margin mystery

..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
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 06h47.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11483 seconds with 16 queries