[CSS 100% Height in IE] HTML met valid CSS wel Firefox !IE

Pagina: 1
Acties:

Acties:
  • 0 Henk 'm!

  • compubink
  • Registratie: September 2000
  • Laatst online: 21:41

compubink

...====...

Topicstarter
Ik ben bezig met het ontwerpen van een website. zoals velen heb ik ook met het probleem gezeten van 100% dmv CSS. Ik heb het probleem nu aardig opgelost met wat trucks gevonden via Google. Probleem is nu dat de website nog niet goed weergegeven wordt in Internet Explorer. Ik heb getest in IE7.

Het gaat om de volgende website:
http://www.xs4all.nl/~rbroeder/gl/

In Firefox laat hij netjes een scrollbar zien wanneer de content in de main div een overflow geeft. In Internet Explorer laat hij de tekst volledig over de footer heen lopen en wordt geen scrollbar gegeven.

Is er iemand die mij op weg kan helpen? Ik ben nu al enkele uren bezig, en heb de website al drie keer opnieuw opgebouwd met steeds nieuwe hacks voor 100% height. Maar krijg het ondanks gevalideerde CSS en HTML niet werkend.

De code:
HTML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
        <head>
    <title>GL</title>
    <meta name="description" content="Website van de GL" />
    <meta name="keywords" content="website" />
    <meta name="copyright" content="x" />
    <meta name="author" content="x" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="language" content="nl" />
    <meta name="Distribution" content="Global" />
    <meta name="Rating" content="General" />
    <meta name="Robots" content="INDEX,FOLLOW" />
    <meta name="Revisit-after" content="7 Days" />
<style type="text/css">
html {
    height:100%;
    max-height:100%;
    padding:0;
    margin:0;
    border:0;
    background-color:#fff;
    overflow: auto;
    /* hide overflow:hidden from IE5/Mac */
    /* \*/
    overflow: hidden;
    /* */
}

body {
    height:100%;
    max-height:100%;
    padding:0;
    margin:0;
    border:0;
    overflow: auto;
}

#content {
    display:block;
    position:absolute;
    z-index:4;
    top:163px;
    bottom:22px;
    width:100%;
    margin-left:0px;
    background-color: #fff;
}

* html #content {
    top:0;
    bottom:0;
    height:100%;
    border-top:163px solid #fff;
    border-bottom:22px solid #fff;
}

#head {
    position:absolute;
    margin-left:0px;
    top:0;
    min-width:100%;
    height:163px;
    overflow: hidden;
}

#headmenu {
    position:absolute;
    margin-left:0px;
    top:103px;
    min-width:100%;
    height:60px;
    z-index:5;
    overflow: hidden;
    background-color: #005398;
}

* html #head {
    top:2px; height:110px;
}

#foot {
    text-align:center;
    position:absolute;
    margin-left:0px;
    bottom:0;
    width:100%;
    min-width:100%;
    padding-top:0px;
    height:22px;
    background-color: #005398;
}

* html #foot {
    bottom:0px; height:22px;
}

.left {float:left; margin:10px; border:1px solid #000;}
.right {float:right; margin:10px; border:1px solid #000;}
.lefttext {float:left; width:267px; text-align:justify;}
.righttext {float:right; width:267px; text-align:justify;}

* html .lefttext {float:left; width:267px; text-align:justify;}
* html .righttext {float:right; width:267px; text-align:justify;}

#botleft {
    float: left;
    background-color: #89ba17;
    width: 267px;
    height: 22px;
}

#botmid {
    float:left;
    background-image: url('img/bottom_mid.jpg');
    background-repeat: no-repeat;
    width: 184px;
    height: 22px;
    margin-left: 15%;
}

#botright {
    float:right;
    background-image: url('img/bottom_right.jpg');
    background-repeat: no-repeat;
    width: 126px;
    height: 22px;
}

#toplogo {
    background-image: url('img/top_logo.jpg');
    background-repeat: no-repeat;
    width: 401px;
    height: 103px;
}

#topleft {
    clear: left;
    float: left;
    background-image: url('img/top_left.jpg');
    background-repeat: no-repeat;
    background-color: #005398;
    width: 190px;
    height: 60px;
}

#topmid {
    float: left;
    top: 114px;
    background-image: url('img/top_mid.jpg');
    background-repeat: no-repeat;
    width: 144px;
    height: 61px;
    margin-left: 30%;
}

#topright {
    float:right;
    background-image: url('img/top_right.jpg');
    background-repeat: no-repeat;
    width: 57px;
    height: 61px;
}

#menu {
    float: left;
    width: 267px;
    min-height: 100%;
    height: 100%;
    padding-bottom: 0px;
    background-color: #005398;
    overflow: auto;
}

#main {
    position: relative;
    overflow: auto;
    height: 100%;
    text-align: left;
    font-family: arial, sans-serif;
}

* html #main {
    overflow: auto;
}

.menutitle {
    padding-left: 30px;
    height: 23px;
    width: 237px;
    font-family: arial, sans-serif;
    font-weight: bolder;
    color: #fff;
    margin-bottom: 20px;
}

.menu_one {
    background-color: #2e7d83;
}

.menu_two {
    margin-top: 20px;
    background-color: #609a61;
}


.menu_three {
    margin-top: 20px;
    background-color: #6ea450;
}

.menu_links {

    margin-bottom: 20px;
}

.menu_links a:link, #list-menu a:active, #list-menu a:visited {
    color: #fff;
}

.menu_links a:hover {
    background: #89ba17;
    color: #fff;
}

.menu_links ul {
    margin: 0;
    padding: 0;
    list-style-type: none;
}

.menu_links a {
    padding-left: 30px;
    font-family: arial, sans-serif;
    color: #fff;
    display: block;
    width:237px;
    text-decoration: none; /*lets remove the link underlines*/
}

#credits {
    text-align:center;
    position:absolute;
    margin-left:120px;
    bottom:0;
    width:100%;
    min-width:100%;
    height:22px;
    font-size: small;
    color: #fff;
}

#credits a, a:hover, a:active, a:visited {
    text-decoration: none;
    color: #fff;
}

#main h1 {
    padding-top: 10px;
    padding-left: 25px;
    color: #005398;
}

#main h2 {
    padding-top: 5px;
    padding-left: 25px;
    color: #005398;
}

#main h3 {
    padding-left: 25px;
    color: #005398;
}

#main p {
    margin: 10px 25px 25px 25px;
}

</style>
</head>
<body>
<div id="head">
    <div id="toplogo">&nbsp;</div>
</div>
<div id="headmenu">
    <div id="topleft">&nbsp;</div>
    <div id="topmid">&nbsp;</div>
    <div id="topright">&nbsp;</div>
</div>

<div id="foot">
    <div id="botleft">&nbsp;</div>
    <div id="botmid"></div>
    <div id="botright">&nbsp;</div>
</div>
<div id="credits">Copyright</div>

<div id="content">
    <div id="menu">
        <div class="menutitle menu_one">
            menu_titel
        </div>
        <div class="menu_links">
            <ul>
            <li><a href="spoed.htm">item_1</a></li>
            <li><a href="spoed.htm">item_2</a></li>
            <li><a href="spoed.htm">item_3</a></li>
            <li><a href="spoed.htm">item_4</a></li>
            <li><a href="spoed.htm">item_5</a></li>
            <li><a href="spoed.htm">item_6</a></li>
            <li><a href="spoed.htm">item_7</a></li>
            </ul>
        </div>
    </div>
    <div id="main">
        <h1>Test 2008</h1>
        text
    </div>
</div>
</body>
</html>

Acties:
  • 0 Henk 'm!

Verwijderd

In Internet Explorer
Welke versie?

Het was laat :)

[ Voor 21% gewijzigd door Verwijderd op 03-02-2009 10:40 ]


Acties:
  • 0 Henk 'm!

  • Tehkram
  • Registratie: Januari 2009
  • Laatst online: 18-12-2022
IE7 zoals in de post gezegd.

@compubink

Ik zie dat je nog "ouderwetse" *html hacks gebruikt, ik heb zo'n vermoeden dat IE7 hier op faalt omdat je niet in Quirks mode draait.

Lees dit artikel even en kijk of je hier iets wijzer van word:

http://molly.com/2005/12/22/star-html-and-microsoft-ie7/

Acties:
  • 0 Henk 'm!

  • Da Weef
  • Registratie: Januari 2004
  • Laatst online: 15-09 09:16
Sowieso is het semantisch niet allemaal even verantwoord... En waarom het wiel opnieuw uitvinden wat betreft de layout? Er zijn voldoende vergelijkbare layouts voor het grijpen die je enkel licht hoeft aan te passen:

http://www.cssplay.co.uk/layouts/

.


Acties:
  • 0 Henk 'm!

  • MBV
  • Registratie: Februari 2002
  • Laatst online: 20:27

MBV

De netste manier om valide CSS voor IE specifiek te maken is met conditional comments:
HTML:
1
2
3
4
5
6
7
8
9
10
<head>
  <style type="text/css">
 /*veel layout*/
  </style>
  <!--[IF IE 7]>
    <style type="text/css">
      /* IE7 hacks */
    </style>
  <![endif]-->
</head>

100% valid CSS/HTML, en geen wazige hacks die het alleen in sommige IE-versies doen.

Acties:
  • 0 Henk 'm!

  • DG.
  • Registratie: December 2008
  • Laatst online: 09-08-2023

DG.

Je moet de footer onder de main doen.
Je kunt dan de <div id="clear"></div> gebruiken
Als je dan een height in de main instelt gaat die als goed is over in een scrollbar.
Succes er mee.

Acties:
  • 0 Henk 'm!

Verwijderd

da's de meest ranzige oplossing ooit (en hele volksstammen die het nog toepassen). Daar is gewoon overflow voor

Acties:
  • 0 Henk 'm!

  • MBV
  • Registratie: Februari 2002
  • Laatst online: 20:27

MBV

Hoezo? Je zal toch iets moeten clearen, als alles een float is is er geen enkele manier waarop de browser erachter komt dat er scrollbars getoond moeten worden voor de hele pagina :?

Acties:
  • 0 Henk 'm!

  • Clay
  • Registratie: Oktober 1999
  • Laatst online: 20-08 09:22

Clay

cookie erbij?

De overflow property bepaalt dus in hoe de content area van een block level element zich gedraagt, check bv het verschil tussen (ff ranzig):

HTML:
1
2
3
4
5
6
<p style="background:green;">
    <span style="float:left; width:100px; background:red;">
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    </span>
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
</p>


en met overflow op de p:

HTML:
1
2
3
4
5
6
<p style="background:green;   overflow:auto;    ">
    <span style="float:left; width:100px; background:red;">
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    </span>
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
</p>


In de eerste snippet zal de span buiten de p vallen, die heeft nml impliciet een overflow:visible, en dat betekent dat content buiten het block mag vallen.

In de tweede snippet wordt de p uitgerekt tot die de float omvat. Overflow auto (of hidden of scroll) zorgen er nml voor dat de content area meegroeit (er is nml geen fixed height), en hebben elk een verschillende oplossing om content die dan via een andere constructie alsnog zou overflowen, te behandelen.

De CSS spec legt dit ergens ook beter uit, maar ik kan het ff niet vinden :P

En zo heb je dus geen clear nodig. IE6 heeft nog een trap nodig (zoveelste haslayout issue dacht ik), en vanaf IE7 gaat het gewoon goed.

Instagram | Flickr | "Let my music become battle cries" - Frédéric Chopin

Pagina: 1