/ Forside / Teknologi / Udvikling / HTML / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
HTML
#NavnPoint
molokyle 11184
Klaudi 5506
bentjuul 3377
severino 2040
smorch 1950
strarup 1525
natmaden 1396
scootergr.. 1320
e.c 1150
10  miritdk 1110
DIV vil ikke være 1px i height i IE
Fra : Brian Hansen


Dato : 29-11-04 22:13

Prøv at se på http://users.cybercity.dk/~ida4328/test.html

Hvorfor bliver div'erne mere end 1px i height i Internet
Explorer?

CSS'en er Prøv at se på
http://users.cybercity.dk/~ida4328/test.css

--
Vil du lære at kode HTML, XHTML, CSS, SSI, ASP eller ASP.NET?
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! => http://www.html.dk/tutorials

 
 
Brian Hansen (29-11-2004)
Kommentar
Fra : Brian Hansen


Dato : 29-11-04 22:17

Brian Hansen wrote in dk.edb.internet.webdesign.html:
> Prøv at se på http://users.cybercity.dk/~ida4328/test.html
>
> Hvorfor bliver div'erne mere end 1px i height i Internet
> Explorer?
>
> CSS'en er Prøv at se på
> http://users.cybercity.dk/~ida4328/test.css
>
> --
> Vil du lære at kode HTML, XHTML, CSS, SSI, ASP eller ASP.NET?
> - Pædagogiske tutorials på dansk
> - Kom godt i gang med koderne
> KLIK HER! => http://www.html.dk/tutorials

Minder vist lidt om det her:

This may be a difficult concept, but it serves useful purposes,
so just accept it. At this stage, we have not lost IE. No, it
gets this right up to here. But now lets start making a mess.
With IE, if you apply a width to the empty paragraph (usually
unintentionally while applying it to all paragraphs), it decides
that you want to give it some height too. So it makes it big
enough to contain one line of text. Not only does this one line
of extra height now get added to the space, but the collapsing is
all wrong. So the gap grows to max(10,30) + max(40,20) +
line-height, so 40 pixels becomes more like 90. And before you
try to use the height style to make it smaller, IE will ignore
you. It will still make it one line-height tall, because of its
incorrect overflow:visible; handling.

In response, the web developer applies some negative margins or
relative positioning, without really knowing what they are doing
or why, until the gap returns to normal in IE, about 40 pixels.
(This assumes that IE does not decide to cut off the content
where a negative margin pushes it over the bounds of its original
position.) Of course, this has a very bad effect in the other
browsers, as they correctly apply the 40 pixels, plus the
negative 50 that was applied for IE, meaning the contents of the
two paragraphs now overlap by 10 pixels. Definitely not the
intended effect. This is a bit of an extreme example, but the
effect is the same, even if a normal margin (or the browser's
default margin) is applied to the paragraphs.

Lorte IE!

--
Vil du lære at kode HTML, XHTML, CSS, SSI, ASP eller ASP.NET?
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! => http://www.html.dk/tutorials

Brian Hansen (29-11-2004)
Kommentar
Fra : Brian Hansen


Dato : 29-11-04 22:19

Brian Hansen wrote in dk.edb.internet.webdesign.html:
> Prøv at se på http://users.cybercity.dk/~ida4328/test.html
>
> Hvorfor bliver div'erne mere end 1px i height i Internet
> Explorer?
>
> CSS'en er Prøv at se på
> http://users.cybercity.dk/~ida4328/test.css
>
> --
> Vil du lære at kode HTML, XHTML, CSS, SSI, ASP eller ASP.NET?
> - Pædagogiske tutorials på dansk
> - Kom godt i gang med koderne
> KLIK HER! => http://www.html.dk/tutorials

Ok, jeg fandt langt om længe løsningen!

overflow: hidden;

Sorry!


--
Vil du lære at kode HTML, XHTML, CSS, SSI, ASP eller ASP.NET?
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! => http://www.html.dk/tutorials

Søg
Reklame
Statistik
Spørgsmål : 177502
Tips : 31968
Nyheder : 719565
Indlæg : 6408534
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste