It seems to me that some DOCTYPE
declarations in IE (6-8) may cause the browser to ignore height="100%"
on tables and divs (style="height:100%"
)
E.g
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Test1</title>
</head>
<body>
<div style="border: 2px solid red; height: 100%">
Hello World
</div>
</body>
</html>
Will render the DIV
with the height of the text, it will not stretch. Removing the DOCTYPE
declaration causes the DIV
to stretch vertically as desired.
So my questions are:
- Why does it happen?
- How do you keep the
DOCTYPE
and still allow tables to stretch?
- Does / did it happen to you?
- Did you know about it?, is it well known?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…