Link to home
Start Free TrialLog in
Avatar of fuze44
fuze44Flag for United States of America

asked on

Firefox 3's handling of CSS table width

Ok, something has changed from FF2 to FF3.  My site had  a width of 100% assigned to a table.  The table would stretch out to fill its defined div.  Now the FF seems to reinterpret that instruction.  It collapses the width to only be as wide as the column headers which is only about 50% of the width of its div (which is itself about 80& of the screen width).

I need this width to be percentage based because my people use a range of screen resolutions.

I can't find any discussion about this.

Thank you.
Avatar of level9wizard
level9wizard
Flag of Canada image

Under what doctype? Using a html 4.0 transitional doctype will likely cause this from 2 to 3.

Also, how are you declaring this width? Are you doing something like:
<table width="100%">

or something like:
<table style="width: 100%">

The way you declare this will absolutely cause a change from browser to browser and version to version based on what doctype you define and better yet, if any at all.

Paste your full code and we can better asses this.
Avatar of fuze44

ASKER

Level9Wizard, thanks for checking this out.  I've simplified the html and css down to just the essentials which result in this behavior.  This should make it easier to read.

I noticed that "http://www.w3.org/TR/html4/loose.dtd" wasn't included with the doctype declaration, but doing so destroys the layout in IE.  Not sure of what's going on behind the scenes with that.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
 
<html>
<head>
<style>
 
body {
margin:0px;
background-color:#AAA;
}
 
* html body {
overflow:auto;
} /* Hack to eliminate unneccessary vert scroll in IE */
 
#container {
width:100%;
}
 
#content {
visibility:visible;
position:absolute;
left:125px;
margin-left:10px;
margin-right:10px;
}
 
#table_patients {
width:99%;
margin:10px 0 0 0;
border-style:solid;
border-width:2px;
border-collapse:separate;
background-color:#EEEEEE;
}
 
* html #table_Patients {
margin:10px 0px 0 -1px ;
} /* Hack to eliminate horiz scroll in IE */
 
</style>
</head>
 
<body>
<div id="container">
  <div id="content">
      <TABLE ID="table_patients" CELLPADDING="3" CELLSPACING="0" BORDER="5"; > 
	<TR>
	  <TH COLSPAN=7 ALIGN="CENTER" width="100%"><H2>No Patients Match Criteria</H2></TH>
	</TR>
	<TR>
	  <TH>Info</TH><TH>Patient Name</TH><TH>Phone</TH><TH>Address</TH><TH>City</TH><TH>State</TH><TH>Zip</TH>
	</TR>
      </TABLE>
  </div>
</div>
</body>
</html>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of fuze44
fuze44
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial