Forum Moderators: not2easy
Could you please have a look at this code snippet and see why its displaying differently in IE and Firefox.
It is showing "correctly" in IE but it comes up messed up in Firefox.
<style type="text/css">
* {
margin:0;
padding:0
}.body_container{
width: 97%;
height:100%;
min-width:700px;
margin-top:15px;
margin-bottom:0px;
margin-left:0px;
margin-right:0px;
text-align:left;
}
.right_colbox_container{
width: 25%;
border:1px solid #efd7f0;
float:right;
margin-top:5px;
height:30px
}
.left_colbox_container{
width: 74%;
border:1px solid #efd7f0;
float:left;
diplay:inline;
margin-top:5px;
height:30px
}
.box_header{
width: 100%;
height:23px;
background:#efd7ff;
}
.box_content{
height:100%;
}
.box_content th{
background:#efd7ff;
height:40px;
padding:3;
text-align:center;
}
.right_colbox_container th{
background:#efd7ff;
height:18px;
padding:2;
text-align:center;
}
</style>
<div class="body_container">
<div class="left_colbox_container">
<div class="box_header">
<table width="100%" border="0" cellpadding="3">
<thead>
<tr>
<th><bean:message key="gen.Flight"/></th>
</tr>
</thead>
</table>
</div>
<div class="box_content">
<html:form action="searchConsignmentByFlightResult" onsubmit="return validateConsignmentSearchForm(this);">
<table width="100%" border="0" cellpadding="3" cellspacing="2">
<tr>
<td width="5%"><bean:message key="gen.Flight"/></td>
<td width="3%"><html:text property="carrierCode" size="3" maxlength="3"/></td>
<td width="4%"><html:text property="flightNumber" size="3" maxlength="3"/></td>
<td width="4%"><html:text property="flightDate" size="2" maxlength="2"/>
</td>
<td width="10%">
<html:select property="flightMonth">
<html:option value="">Select</html:option>
<html:option value="January">January</html:option>
<html:option value="February">February</html:option>
<html:option value="March">March</html:option>
</html:select>
</td>
<td width="4%"> <html:submit value="Find"/></td>
<td width="3%"> </td>
<td width="5%"><bean:message key="SearchConsignmentsByFlight.origin"/></td>
<td width="6%"> </td>
<td width="5%"><bean:message key="SearchConsignmentsByFlight.Destination"/></td>
<td width="8%"> </td>
<td width="17%"><bean:message key="SearchConsignmentsByFlight.portoffirstentry"/></td>
<td width="10%"> </td>
<td width="5%"><bean:message key="SearchConsignmentsByFlight.sta"/></td>
<td width="11%"> </td>
</tr>
</table>
</html:form>
</div>
</div>
<div class="right_colbox_container">
<div class="box_header">
<table width="100%" border="0" cellpadding="3">
<thead>
<tr>
<th><bean:message key="text.EntrySummaryDeclaration"/></th>
</tr>
</thead>
</table>
</div>
<div class="box_content">
<table width="100%" border="0" cellpadding="3">
<tr>
<td><bean:message key="text.LocalReference"/></td>
</tr>
</table>
</div>
</div>
<div class="left_colbox_container">
<div class="box_content">
<table width="100%" border="0" cellpadding="3">
<thead>
<tr>
<th width="10%"><bean:message key="text.selectall"/></th>
<th width="15%"><bean:message key="text.awb"/></th>
<th width="10%"><bean:message key="text.hwb"/></th>
<th width="22%"><bean:message key="text.airportofloading"/>
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td><bean:message key="text.loading"/></td>
<td><bean:message key="text.unloading"/></td>
</tr>
</table>
</th>
<th width="8%"><bean:message key="text.pieces"/></th>
<th width="35%"><bean:message key="text.goodsdescription"/> </th>
</tr>
</thead>
<tbody>
<tr>
<td> </td>
<td> e</td>
<td> e</td>
<td> e</td>
<td> e</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> e</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> e</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="right_colbox_container">
<div class="box_content">
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<thead>
<tr>
<th><bean:message key="SearchConsignmentsByFlight.consignmentindeclaration"/></th>
</tr>
</thead>
</table>
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<thead>
<tr>
<th><bean:message key="text.awb"/></th>
<th><bean:message key="text.hwb"/></th>
</tr>
</thead>
<tbody>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
Thanks
Just to clarify, the weird tags are just tags that are used within the struts framework. This are java references which only affect the display on the server side.
When the webserver has returned the page it is returned as shown below for the browser to render it. The browser does not see those tags.
Here is a different version without the struts tags.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>CCS21</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="pragma" content="no-cache">
</head>
<body onLoad="pageinit()"><center>
<style type="text/css">
* {
margin:0;
padding:0
}
.body_container{
width: 97%;
height:100%;
min-width:700px;
margin-top:15px;
margin-bottom:0px;
margin-left:0px;
margin-right:0px;
text-align:left;
}
.right_colbox_container{
width: 25%;
border:1px solid #efd7f0;
float:right;
margin-top:5px;
height:30px
}
.left_colbox_container{
width: 74%;
border:1px solid #efd7f0;
float:left;
diplay:inline;
margin-top:5px;
height:30px
}
.box_header{
width: 100%;
height:23px;
background:#efd7ff;
}
.box_content{
height:100%;
}
.box_content th{
background:#efd7ff;
height:40px;
padding:3;
text-align:center;
}
.right_colbox_container th{
background:#efd7ff;
height:18px;
padding:2;
text-align:center;
}
</style>
<div class="body_container">
<div class="left_colbox_container">
<div class="box_header">
<table width="100%" border="0" cellpadding="3">
<thead>
<tr>
<th>Flight</th>
</tr>
</thead>
</table>
</div>
<div class="box_content">
<form name="consignmentSearchForm" method="post" action="/ccs21/main/searchConsignmentByFlightResult" onsubmit="return validateConsignmentSearchForm(this);">
<table width="100%" border="0" cellpadding="3" cellspacing="2">
<tr>
<td width="5%">Flight</td>
<td width="3%"><input type="text" name="carrierCode" maxlength="3" size="3" value=""></td>
<td width="4%"><input type="text" name="flightNumber" maxlength="3" size="3" value=""></td>
<td width="4%"><input type="text" name="flightDate" maxlength="2" size="2" value="">
</td>
<td width="10%">
<select name="flightMonth"><option value="" selected="selected">Select</option>
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option></select>
</td>
<td width="4%"> <input type="submit" value="Find"></td>
<td width="3%"> </td>
<td width="5%">Origin:</td>
<td width="6%"> </td>
<td width="5%">Dest:</td>
<td width="8%"> </td>
<td width="17%">Post of first entry:</td>
<td width="10%"> </td>
<td width="5%">STA:</td>
<td width="11%"> </td>
</tr>
</table>
</form>
</div>
</div>
<div class="right_colbox_container">
<div class="box_header">
<table width="100%" border="0" cellpadding="3">
<thead>
<tr>
<th>Entry Summary Declaration</th>
</tr>
</thead>
</table>
</div>
<div class="box_content">
<table width="100%" border="0" cellpadding="3">
<tr>
<td>Local Reference:</td>
</tr>
</table>
</div>
</div>
<div class="left_colbox_container">
<div class="box_content">
<table width="100%" border="0" cellpadding="3">
<thead>
<tr>
<th width="10%">Select All</th>
<th width="15%">AWB</th>
<th width="10%">HWB</th>
<th width="22%">Airport of Loading
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td>Loading</td>
<td>Unloading</td>
</tr>
</table>
</th>
<th width="8%">Pieces</th>
<th width="35%">Goods Description </th>
</tr>
</thead>
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="right_colbox_container">
<div class="box_content">
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<thead>
<tr>
<th>Consignments In Declaration</th>
</tr>
</thead>
</table>
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<thead>
<tr>
<th>AWB</th>
<th>HWB</th>
</tr>
</thead>
<tbody>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>
ps. I used the [code] tag but the code is not being formatted on forum. Does anyone know why?
Could you please have a look at this code snippet and see why its displaying differently in IE and Firefox.
It is showing "correctly" in IE but it comes up messed up in Firefox.
[code] tags don't work very well.
try
[pre][code]
code
[/code][/pre]
instead and:
As to your question itself, it's like driving backwards for me it'll take some time to spot what you want to happen.
Start by validating [validator.w3.org]. While that won't resolve the display problem, it will point you to things like the <body> element opening in the <head>, the tables that open but don't close, duplications, and other errors. These things won't fix the display/layout issues, but they are directly relevant because part of the the display issue is caused by each browser displaying the "broken" code differently.
After that, I suggest simplify your markup. This looks like tabular data that could easily be displayed in one or two very simple tables (with a dash of css for style).
However, the provided code seems to use the table elements to create a visual "look". For eg, those tables with just a table head look like they've been put in to use <th> to produce the visual display of a "heading". That's very redundant and complicated - and that immediately creates potential display issues - which just means more unecessary code to resolve them.
I know my response doesn't fix your display differences - so post back once you've validated.
I decided to forget about CSS as it was just taking too much time to try and solve something that would have taken me 2 minutes to do using tables.
I really think that CSS is worthless as long as browsers support it differently. I think for now i will forget about css and use tables. I might change my mind when all browsers decide to work the same way.
Given the limitation of time and the workload that people usually have, it just doesnt make sense to spend hours and hours to try and get css to work.
Thanks all that tried to help. I will try and see if i can resolve it if i get some spare time at home just to get some exprerience with it.