Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Div width

Reply
Thread Tools

Div width

 
 
Robert Larsen
Guest
Posts: n/a
 
      09-22-2008
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 ?
 
Reply With Quote
 
 
 
 
Ari Heino
Guest
Posts: n/a
 
      09-22-2008
> Can anybody tell me how to make this work in all browsers ?

Check
http://matthewjamestaylor.com/blog/u...ail-pixels.htm

--
Ari
http://users.utu.fi/athein/
 
Reply With Quote
 
 
 
 
Ari Heino
Guest
Posts: n/a
 
      09-22-2008
> Another thing, if margin and padding have a value of zero, then why
> use them?


Because they are necessarily _not_ set to zero initially by all browsers.

--
Ari
http://users.utu.fi/athein/
 
Reply With Quote
 
Nik Coughlin
Guest
Posts: n/a
 
      09-22-2008
"richard" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Mon, 22 Sep 2008 20:49:43 +0300, Ari Heino <(E-Mail Removed)>
> wrote:
>
>>> Another thing, if margin and padding have a value of zero, then why
>>> use them?

>>
>>Because they are necessarily _not_ set to zero initially by all browsers.

>
>
> 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.

 
Reply With Quote
 
Ari Heino
Guest
Posts: n/a
 
      09-23-2008
> I'm supposed to write code to satisfy each and every browser there is?
> The hell if I will.


Welcome to the real world.

--
Ari
http://users.utu.fi/athein/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
<div ... /> and <div ...></div> K Viltersten ASP .Net 4 03-31-2009 07:33 PM
two div in one line, first div's width is const and the second isn't tomek milewski HTML 6 06-25-2007 09:28 PM
set div width to remaining width of the browser Steve Richter ASP .Net 2 06-15-2007 06:40 PM
how to: div width = browser.width? =?Utf-8?B?cm9kY2hhcg==?= ASP .Net 3 10-30-2006 05:43 AM
Textbox width scaling to width of data not width of page? AndrewF ASP .Net 1 10-10-2005 04:38 PM



Advertisments