Click to See Complete Forum and Search --> : Layout close in IE, but wins no cigar
Jayhawk
05-25-2005, 11:36 PM
It works in Firefox. The page in question is here (http://www.sonora-sw.com/eight/index.html), with the css pages here (http://www.sonora-sw.com/eight/bassco.css) and here (http://www.sonora-sw.com/eight/floating.css).
It's looking good down to the buttons on the lower right, which are extending below the bottom edge of the list box in IE. I am pretty sure it is those two blue buttons being low that is pushing the text line and the red button too low.
Notice (if you look at the source) that the contents of the list box is in a table, which I believe to be a proper application of tables, and the rest is all css layout. I'm new at this, so it may not all be done the best way, but it mostly works.
Most important, use a valid DTD (http://www.w3.org/QA/2002/04/valid-dtd-list.html) which will put IE in standards mode (http://www.w3.org/International/articles/serving-xhtml/#quirks)
I would suggest using:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>The Major Company</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="bassco.css" rel="stylesheet" type="text/css">
<link href="floating.css" rel="stylesheet" type="text/css">
</head>
Now IE and FF look the same, but the text is still being pushed down.
Add to css:
.cright img {display:block;}
Your css is very bloated.
Instead of:
.black-4 {
font-family: Arial, Helvetica, sans-serif;
font-size: 4pt;
font-weight: bold;
color: #000000;
}
.black-6 {
font-family: Arial, Helvetica, sans-serif;
font-size: 6pt;
font-weight: bold;
color: #000000;
}
.maroon-12 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12pt;
font-weight: bold;
color: #98002E;
}
/* more of the same */
do this:
html, body, table {
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt; /* should use relative units http://www.w3.org/QA/Tips/font-size */
font-weight: bold;
color: #000;
background: #fff; /* always define this to override users color */
}
.black-4 {
font-size: 4pt;
}
.black-6 {
font-size: 6pt;
}
.maroon-12 {
font-size: 12pt;
color: #98002E;
}
http://www.websiteoptimization.com/speed/7/
http://www.orderedlist.com/articles/writing_lean_css
Another bloated area is the table.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>css table</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
/* cascading style sheet */
html, body, table {
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt; /* should use relative units http://www.w3.org/QA/Tips/font-size */
font-weight: bold;
color: #000;
background: #fff; /* always define this to override users color */
}
table {
border: 3px inset rgb(145, 0, 0);
width: 450px;
/* height: 403px; */
padding:3px 3px 3px 15px;
}
table a {
text-decoration: none;
color: rgb(0, 0, 128);
}
.completed a {
color: rgb(0, 128, 0);
}
-->
</style>
</head>
<body>
<table summary="Major Assignments">
<colgroup>
<col width="50" style="padding:3px 3px 3px 15px;"><col width="50"><col width="95"><col width="190"><col width="18">
</colgroup>
<tbody>
<tr><td>5001</td><td><a href="o_revassn.php?Anum=5001">05-30</a></td><td><a href="o_revassn.php?Anum=5001">51, Rebecca</a></td><td><a href="o_revassn.php?Anum=5001">Tecate and Jacumba</a></td><td><a href="o_revassn.php?Anum=5001">2:2</a></td></tr>
<tr><td>5002</td><td><a href="o_revassn.php?Anum=5002">05-27</a></td><td><a href="o_revassn.php?Anum=5002">64, John</a></td><td><a href="o_revassn.php?Anum=5002">15 Corridor & Ballast Point</a></td><td><a href="o_revassn.php?Anum=5002">16:11</a></td></tr>
<tr class="completed"><td>5013</td><td><a href="o_revassn.php?Anum=5013">05-15</a></td><td><a href="o_revassn.php?Anum=5013">26, Regina</a></td><td><a href="o_revassn.php?Anum=5013">Interim - Central</a></td><td><a href="o_revassn.php?Anum=5013">9:9</a></td></tr>
</tbody>
</table>
</body>
</html>
To align the values in the last column use or as a style in the last <col>:
td {
text-align:":";
}
unfortunately no browser supports this yet.
This function does the same:
<script type="text/javascript">
<!--
onload=function() {
var aTD=document.getElementsByTagName('tr');
for(var i=0; i<aTD.length; i++) {
var oAnchor=aTD[i].getElementsByTagName('td')[4].firstChild;
if(oAnchor.firstChild.data.indexOf(':')==1) {
oAnchor.style.paddingLeft='0.5em';
}
}
}
//-->
</script>
Jayhawk
05-26-2005, 07:31 AM
This is nice stuff, Fang. I like writing good code and you are making mine better.
I tried that doctype, that was one of the things I'd thought of, but not in conjunction with the charset. All your fixes are in place and (of course) make a difference, but IE is still off -- just in different places now. Basically that the "scroll bar" is too far away from the list box, and the text is crowding the right edge of the box. (The box is displaying too narrow?)
Still having trouble getting images to stay on the right side of the <cright> containers. On the last line of the display for instance, I had to make the container the exact width of the button. The containder is floating right in the <cbox> object, but the button image is floating left in the <cright> object.
I had to add "div" and "span" to the first definition in the css file to get things to work right, but that didn't take all that much figuring out.
I didn't see how your def of the displayed container for the list differed significantly from mine, so I left mine. I like having it local in the event of changes being needed. More from you would be welcome.
I really like the methodology for the table, but it spreads the table out and made me enlarge the whole display more than a wanted to. I spent an hour or so experimenting and can't find any way to reduce or eliminate cellspacing or cellpadding -- cannot find any written docs and nothing I tried worked.
Thanks again for your input. The links in my original post are still active, and the files have been updated.
Jayhawk
05-26-2005, 11:07 AM
Is it always this much trial and error to get browsers to agree on how to display a page?
You had subtracted from the <div> height for the two lower buttons. IE didn't care about that, but FF did: the buttons jumped out of line and displayed in their own column to the right. I took a guess and made that <div> the same height as the list box, and that brought the buttons back into line so that FF and IE now agree. It's a bit of a nit to pick, but IE still shows the red button just a tiny bit short of being right-justified.
More serious is the list within the box. FF displays it beautifully, but IE ignores the 7px padding spec on left and right. I changed the text alignment in the 1st column because assignment numbers can be from 3 to 5 digits and we want then left aligned, so centering then in the column is not good. I've beat on it for a while, and I cannot fine any way to make IE quit jamming the text up against the box margins.
Unfortunately, the managers mostly use IE, so I need to violate the rule about making it right -- I need to tweak it for IE even if IE is displaying it wrong. I'd much rather find a way to make it look right in both, but if I can't it needs to work in IE. Sad, but...
(I keep encouraging the shoppers to get Firefox. I will hate it if my advice causes them to be looking at sloppy tables. Come on, guys, help me out here.)
drhowarddrfine
05-26-2005, 03:14 PM
I'm kinda rushed for time but whenever I find IE not cooperating with margins and padding it's because IE will assume them when they aren't supposed to. I always set margin and padding to 0 when I start just to make sure anything in there is what I designed in.
Jayhawk
05-26-2005, 08:17 PM
The problem here is IE is exhibiting a zero padding. It is ignoring the defined padding that Firefox is obeying.
About a month ago I scrapped a project altogether because I could not get IE and FF to display it in a close enough similarity and this board and another one had no answer. In this case it begins to appear that I will have to live with the fact that my work will look good in one browser and sloppy in the other, and I have put in way too much time on one lousy screen layout. I am by no means sold on the use of CSS. Granted, I am still learning it, but....
Remove the padding from the table style and add td {padding:0 7px;} to the css
Floated buttons change:
<div class="cright" style="position:relative; height:424px !important;height:434px; background-color: #cdcdcd;">
<img src="nt_noarr.gif" class="space" alt="no arrow"style="text-align:left;">
<div style="position:absolute; bottom:0; left:0;">
<img src="nt_end.gif" class="space" style="margin-top:2px; alt="end">
<img src="nt_dnarr.gif" alt="down arrow">
</div>
</div>
Jayhawk
05-27-2005, 07:57 AM
Each fix leads to more questions. First, the <td> padding fixed that issue. The columns (including padding) add up to 498px, about 30px greater than the 468px I defined the table container at. I assume the container "squeezes" the columns proportionately. (I'm in the process of widening everything out now.)
What was the "!important;height:434px;" supposed to do? What it did do was nothing in FF and push the blue buttons below the box in IE. I took it out and that part is working okay.
Generically, what is the "!important" specification? I'm reading it as "not important" but I have a feeling it may be just the opposite.
Last item is another wierd thing. The red button is short of alignment with the blue ones in IE but is perfect in FF. By putting borders on the <divs> I see that the button div is not floating all the way to the right edge of the <cbox> that contains it. The button <div> is not oversized, it wraps tightly arounf the button. I've tried all kinds of "margin: 0" types of things with no success, and can't go to a negative margin on the button because that would mess uo FF.
Jayhawk
05-27-2005, 08:19 AM
(I'm in the process of widening everything out now.)
Only one problem. I changed the "width: 468px;" to "width: 490px;" and absolutely nothing happened! The rest of the page has widened, but that damned box is the same size.
The longer I work with this the more absurd it becomes. Anyone?
The longer I work with this the more absurd it becomes
I usually find this is the case when using CSS, especially when it has to do some serious work and not just cope with a couple of divs in a page full of nothing.
You get it perfect in one browser then spend the rest of your life trying to get it to look the same in the rest.
Should work in FF, IE5+ and Opera
Jayhawk
05-28-2005, 09:07 AM
Thanks, Fang. I have learned a lot in the process of developing this one page. I actually did get the layout perfected with an IE hack from another thread on this forum. Your way looks clearer though, and I will apply and test it first part of next week. (My wife has plans for the weekend.)
Last night in about thirty minutes I did the easy part: added the code to activate the buttons the db stuff to generate a real list and deployed that puppy on my client's site. I'm not insane, though. It's in a hidden position for testing by a few selected staff members for the next week. It looks really good tho, and works really fast.