Div width

R

Robert Larsen

Hi

I am trying to get make a div the correct size. I need three areas:
left, center and right. The left and right should have fixed width and
the center should grow or shrink to fit the rest. The following works
perfectly in Firefox, but not in IE:

<html>
<head>
<style>
html, body { background-color: white; margin: 0px; padding:
0px; height: 100%; }
.top { position: absolute; width: 100%; height: 65px;
background-color: blue; }
.left { position: absolute; top: 70px; bottom: 0px; left:
0px; width: 150px; background-color: red; }
.middle { position: absolute; top: 70px; bottom: 0px; left:
155px; right: 205px; background-color: green; }
.right { position: absolute; top: 70px; bottom: 0px; right:
0px; width: 200px; background-color: yellow; }
</style>
</head>
<body>
<div class="top">Top</div>
<div class="left">Left</div>
<div class="middle">Middle</div>
<div class="right">Right</div>
</body>
</html>

Can anybody tell me how to make this work in all browsers ?
 
N

Nik Coughlin

richard said:
So then everytime I have properties in a class or ID, then I should
set all 300 plus items to a default value?

No, but you should understand that they already have a default value and
that you *may* need to override that.
All items in CSS are OPTIONAL. If it's not there, then it should have
no value by default.

No, it should not have "no value" by default - it *will* have a default
value by default, not no value at all.
I'm supposed to write code to satisfy each and every browser there is?
The hell if I will.

This is why some people use a "reset" CSS. I often use *{ margin: 0;
padding: 0; } so that I don't have to think about it, but if you design the
site to be reasonably flexible in the first place then the differences in
the default settings shouldn't break anything.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top