Container positioning (Full Version)

All Forums >> [Web Development] >> Cascading Style Sheets



Message


slbergh -> Container positioning (5/19/2005 15:02:42)

I'm almost ready to go back to tables! [:@] 

I've been putting our website into a CMS. As I do so, I've been redesigning the site using strictly CSS. All was well until earlier this week when I decided I'd go in and start doing everything the "right way". Now, the layout is broken and I'm tearing my hair out. It looks great in IE, but I can't get the container to envelop all the other block elements on the page in FF. I've tried everything I can think of, including putting in a transparent image as a background. For some reason, it will not expand at all unless I specify a height.

Earlier, I did have the height set to 600 px. However, when I set my overflow for my content area to "auto", it either clipped everything off in FF or let it hang outside of my divs. (Ironically, the one time I did have it displaying perfectly in FF, the layout was hosed in IE! [>:])

Anyone with any ideas?

http://www.ehs.iastate.edu/cms/default.asp?action=article&ID=40




Tailslide -> RE: Container positioning (5/19/2005 15:37:39)

Hi there

Don't panic - it's all solvable and we've all been there (frequently!).

I've had a fiddle with the code - I don't have time to finish it but basically you need to set the margin to margin: 0 auto; on the main layout box - take out all the position: fixed that you've got in there - that's what seems to be messing with the border. Add a clear:both to the footer to put it below the main content. This should clear up a lot of the problems - the header will still need a bit of work but it's nearly there. Do that lot and see what's left to do.




slbergh -> RE: Container positioning (5/19/2005 23:22:52)

That did take care of a lot of it. The problem I'm having now is in FF. There's whitespace showing between the nameplate and banner divs. I can't figure out where it's coming from.

(I'd never come across the clear: both before.)




Tailslide -> RE: Container positioning (5/20/2005 4:50:32)

I'll take a look a bit later on today see if I can work it out - I've got to write a database this morning (ooh fun!)

Another big tip though - always code for FF, check it in Opera and fix it for IE - if you try to do it the other way round you'll drive yourself insane!




jaybee -> RE: Container positioning (5/20/2005 6:43:22)

quote:

I'll take a look a bit later on today see if I can work it out - I've got to write a database this morning (ooh fun!)

Another big tip though - always code for FF, check it in Opera and fix it for IE - if you try to do it the other way round you'll drive yourself insane!


Good Lord. If I didn't know any better I'd assume I was logging on here in my sleep under a different name. [;)]

Exactly what I'd have said.




Kitka -> RE: Container positioning (5/20/2005 6:56:34)

quote:

If I didn't know any better I'd assume I was logging on here in my sleep under a different name.


Jaybee has a clone! [:D] [;)]

(so maybe Newcastle Uni wasn't the first:
http://www.guardian.co.uk/genes/article/0,2763,1488401,00.html)




Tailslide -> RE: Container positioning (5/20/2005 7:13:16)

We're going to take over the world!

Resistance is Futile (but funny though!)!




Kitka -> RE: Container positioning (5/20/2005 7:19:10)

Arrgghhhhh! We'll all be reciting Doctypes in our sleep! [sm=lol.gif]

I guess we will have no choice but to ...
[sm=bowdown.gif]




d a v e -> RE: Container positioning (5/20/2005 8:54:27)

you've got a heck of a lot of errors as well
http://validator.w3.org/check?verbose=1&uri=http%3A//www.ehs.iastate.edu/cms/default.asp%3Faction%3Darticle%26ID%3D40
and you'll need to correct those before you can see whether it is something in your stylesheet that is amiss
http://jigsaw.w3.org/css-validator/validator?profile=css2&warning=2&uri=http%3A//www.ehs.iastate.edu/cms/default.asp%3Faction%3Darticle%26ID%3D40

btw the diagram on the front page should be a gif/8 bit png as it has a limited colour palette and will be far clearer and compress more in that format.

nice site though!




c1sissy -> RE: Container positioning (5/20/2005 9:05:33)

quote:

ORIGINAL: slbergh

That did take care of a lot of it. The problem I'm having now is in FF. There's whitespace showing between the nameplate and banner divs. I can't figure out where it's coming from.

(I'd never come across the clear: both before.)


There is a newer method which is pretty good, its called the clearfix. I would suggest that you read through it. I did post some information here in the forum in regards to this one. THe clearfix is supposed to be better then the clear: both method.

Here Is the information on the clearfix, with additional links through the article to the originator of the fix.




slbergh -> RE: Container positioning (5/20/2005 9:25:41)

dave - The validation errors are a battle for another day. The CMS I'm using automatically converts all tags to uppercase, causing many of the errors. When I figure out how to hack the CMS to prevent the conversion, everything should validate. The pages validated before I started putting them into the CMS. (This has been a very long ongoing "update" project...started out as a FP web.)

Thanks for your help with this Tailslide! I've been banging my head against my desk all week! (Now, if I can just remember what I did to get my asp pages to work in the system...!!)




Tailslide -> RE: Container positioning (5/20/2005 10:20:03)

I'm on it - got it validating except for the ASP stuff (don't know how to get that bit right) and looking good in FF and IE - just fiddling to get the banner right in Opera.

Back soon...




jaybee -> RE: Container positioning (5/20/2005 10:50:02)

quote:

Here Is the information on the clearfix,


Deb, I like the idea but the actual operation of the whole thing is horrible! IE hack, Mac hack. I'd rather redesign the page layout.




c1sissy -> RE: Container positioning (5/20/2005 10:52:55)

quote:

ORIGINAL: jaybee

quote:

Here Is the information on the clearfix,


Deb, I like the idea but the actual operation of the whole thing is horrible! IE hack, Mac hack. I'd rather redesign the page layout.



I left out the mac hack, it wasn't working in Opera with it. I found out that was the cause of it.

lol, if you can do the page without hacks, that  is good, but sometimes they are needed, no matter how hard you try to go without them.[;)]




slbergh -> RE: Container positioning (5/20/2005 10:57:05)

Thanks for the link Deb! Maybe someday, when no one else is using CSS anymore, I'll finally get it all cemented in my mind how to use it! 




Tailslide -> RE: Container positioning (5/20/2005 11:06:20)

Right then - here you go.

This page now validates apart from the asp links - I've swapped the DTD to XHTML transitional just to be sure.

It now looks the same in FF, IE 6 and Opera 7.11. You can test other browsers for yourself!!

Here's the code for your first page - I've changed a couple of bits so you'll need to compare before and after to see what I've done. I read your comment about the Upper case CMS monster after I'd converted it all to lowercase (oh well!).

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Iowa State University Dept. of Enviromental Health and Safety | Home Page</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="Iowa State University Dept. of Environmental Health and Safety" />
<meta name="description" content="Extensive website containing health and safety information for Iowa State University" />
<meta name="robots" content="all" />
<!-- to correct Flash of Unstyled Content. http://www.bluerobot.com/web/css/fouc.asp -->
<style type="text/css" media="screen">@import "media/css/layout.css";</style>
<link rel="stylesheet" type="text/css"media="screen" href="media/css/layout.css" />
<link rel="stylesheet" type="text/css" media="screen"href="media/css/homecolor.css" />
<script type="text/javascript">
<!--

function SymError()
{
  return true;
}

window.onerror = SymError;

var SymRealWinOpen = window.open;

function SymWinOpen(url, name, attributes)
{
  return (new Object());
}

window.open = SymWinOpen;

//-->
</script>
<script type="text/javascript"></script>
</head>
<body>
<div id="layout">
<div id="nameplate">
<div id="map"><a href="http://www.iastate.edu"></a></div></div>
<div id="banner"><h4>Welcome!</h4></div>
<div id="mainmenu"><a href="default.asp?action=article&ID=18">Home</a> · <a href="default.asp?action=article&ID=19">Administration</a> ·  <a href="default.asp?action=article&ID=26">Biosafety</a> ·  <a href="default.asp?action=article&ID=201">Emergency Response</a> ·  <a href="default.asp?action=article&ID=68">Environmental Programs</a> ·  <a href="default.asp?action=article&ID=114">General Safety</a> ·  <br /><a href="default.asp?action=article&ID=73">Occupational Health</a> ·  <a href="default.asp?action=article&ID=202">Radiation Safety</a> ·  <a href="default.asp?action=article&ID=160">Training </a></div>
<div id="breadcrumb"> <span><!-- #include file="breadcrumb.htm" --></span></div>
<!-- Here's a new div to help position the floating bits on the page  it ends before the footer - I've added the clearfix hack to it -->
<div id="mainbox" class="clearfix">
<div id="links">
<h5>Services</h5>
<p><a href="http://www.ehs.iastate.edu/oh/cheminv.htm" title="Information on chemical inventories, Chemical Inventory system login">Chemical Inventory</a> <br /><a href="http://www.ehs.iastate.edu/ep/recycle.htm" title="Chemical Redistribution Program information and login">Chemical Redistribution</a> <br /><a href="http://www.ehs.iastate.edu/oh/msds.htm" title="Material Safety Data Sheets">MSDS</a> <br /><a href="http://www.ehs.iastate.edu/hazard.asp" title="Report an observed hazard to EH&S">Report a Hazard</a> <br /><a href="http://www.ehs.iastate.edu/ep/wasteremoval.htm" title="Chemical, sharps and radiological waste removal requests">Waste Removal Request</a> </p>
<h5>Quick Links</h5>
<p><a href="../newsletter.asp" title="EH&S campus newsletter and searchable newsletter archives">Campus Newsletter</a> <br />Committees <br /><a href="http://www.ehs.iastate.edu/training/ebooks.htm" title="E-books on various topics">E-books</a> <br /><a href="http://www.ehs.iastate.edu/admin/employment.asp" title="Current job openings">Employment</a> <br /><a href="http://www.ehs.iastate.edu/forms.asp" title="Forms">Forms</a> <br /><a href="http://www.ehs.iastate.edu/admin/news.asp" title="News and News Archives">News</a> <br /><a href="default.asp?action=article&ID=25" title="Search our website">Search</a> <br /><a href="http://www.ehs.iastate.edu/library.asp" title="Manuals, booklets, newsletters, other publications">Safety Library</a> <br /><a href="http://www.ehs.iastate.edu/admin/directory.asp" title="Staff contacts and biographical information">Staff Directory</a> </p>
<p>* = external link </p> 
</div>

<div id="content" >
<h4>Welcome to EH&S</h4>
<p>Welcome! EH&S is a service unit of Iowa State University, devoted to ensuring the occupational health and safety of all Iowa State personnel, students and visitors.</p>
<p>To aid in this endeavor, EH&S offers a comprehensive health and safety program, incorporating everything from fire safety to radiation safety. We offer a wide array of manuals, E-books and training sessions to ensure that Iowa State University personnel are able to receive the information they need in these areas. </p>
<p>To assist the Iowa State University community even more, we have divided the department into several programs, in order to offer more specialized resources. We are continually adding new programs and services, many web-based, in an attempt to meet the ever-changing needs of Iowa State University's faculty and staff.</p> <!-- enVivo!CMS Classic v3.54 Professional : MFY4-XTG9-VEBL-CN1Q --> 
</div></div>
<div id="footer" class="clearfix">
2809 Daley Drive - Ames, IA 50011-3660 - (515) 294-5359<br />Copyright © 2005, Iowa State University, all rights reserved. 
</div>

</div>

</body>
</html>



And here's the CSS for the Layout:

@charset "iso-8859-1";
body {background: #fff;margin: 0 auto; color: #000; font-style: normal; font-family: verdana, tahoma, sans-serif;line-height:110%; font-size:90%; }

#layout {width: 760px;margin: 0 auto; height:100%;}

#nameplate {background:#cacaac url('../../images/nameplate.jpg');background-repeat: no-repeat ;background-position: left top;	height: 60px;font-size: 70%;	padding-top: 1px;  	padding-bottom: 1px;}
#nameplate li {list-style:none;margin-left:-40px;}
#nameplate li a {height:35px;display:block;}
	
#map {width:310px;}

#banner {color:#fff;width: 100%;height: 50px;padding-top: 1px; padding-bottom: 1px;margin:0;}
#banner h4 {text-align:right;padding:15px; margin: 0 0 0 0;}	

#breadcrumb {width:100%;}	
	
#mainmenu {color:#333300;	font-size: 75%; text-align:center;	width:760px;background-color:#cacaac;padding-top: 1px; padding-bottom: 1px;}
#mainmenu a {color: #333300;}
#mainmenu a:hover {color: #cacaac; text-decoration: none;}
#mainmenu a:active {color: #333300; text-decoration: none;}
#mainmenu ul {list-style-type: disc;}
#mainmenu li {margin: 0 0 3px 0; display: inline;}

#links {width: 185px;font-size: 75%;float: left; margin-bottom: 20px;margin-right: 25px;	}
#links h5 {font-size: 110%;margin: 0;}
#links p {margin-left: 0;	font-size:100%;	padding-bottom: 0;	border-bottom: 1px solid #eee;	line-height: 125%; padding-bottom: 5px;}
#links ul {margin-top:0; margin-left:15px;	font-size:100%;	padding-bottom: 5px;border-bottom: 1px solid #eee;}
#links li {display: block; line-height: 130%; 	list-style-type: none;	margin-left:0px;}
#links li a {display: block; white-space: nowrap;margin-left: 0px;}
#links li a.c {display: inline; font-weight: normal; text-decoration: none;}
#links li a.c:hover {text-decoration: none;}

#content {padding:0 20px 0 20px;margin: 0;text-align: justify; font-size: 75%; color: #000; font-style: normal; font-family: verdana, tahoma, sans-serif;line-height: 160%;}
#mainbox {height:100%; margin:20px}
#footer{background:#cacaac; margin:0;padding: 10px;font-family: verdana, tahoma, sans serif;font-size: 75%;	height: 50px;color: #fff;}

.center{text-align: center;}

h4 {text-align: justify;}
h3 span {display: none;}
h5 {font-weight:bold;font-size: 90%;}
h6 {font-weight:bold;font-style:italic;font-variant: small-caps;font-size:100%;}
	
p#resources {font-weight:bold;	font-style:italic;	font-size:100%;	color:#fff;	padding: 2px;}
	
.pub {font-style: italic;} 	
	
a {text-decoration:none;}
a:hover {text-decoration:underline overline;}
	
table {	width: 95%;}
tr {valign: top;}
td {text-align: left;width:25%;	vertical-align:top;}
th {width:25%;	height:32px;}

.clearfix:after {
    content: "."; 
    display: block; 
    height: 0; 
    clear: both; 
    visibility: hidden;
}

/* Hides from IE-mac \*/
* html .clearfix {height: 1%;}
/* End hide from IE-mac */



I've messed with the CSS and consolidated it a bit (all helps with download time) and taken out anything glaring that I know won't validate but I haven't actually validated it myself!

Don't think I messed with the colour stylesheet - but you'll soon find out!

Going to lie down now for a while...




c1sissy -> RE: Container positioning (5/20/2005 11:19:18)

quote:

ORIGINAL: slbergh

Thanks for the link Deb! Maybe someday, when no one else is using CSS anymore, I'll finally get it all cemented in my mind how to use it! 


You'll get it. IT just takes time. I have been studying this on my own for so long now. Just don't give up.

This one book I"m reading right now is really helping to put things in focus for me. And don't worry about how long its taking you. Just remember that there are designers who have been in the business for years that are struggling with this as well. So, don't be hard on yourself. [;)] 




Tailslide -> RE: Container positioning (5/20/2005 11:22:35)

Oh I think I can guarantee that as soon as everyone figures out CSS totally, "they'll" think up something else to drive us mad!




c1sissy -> RE: Container positioning (5/20/2005 11:27:58)

quote:

ORIGINAL: Tailslide

Oh I think I can guarantee that as soon as everyone figures out CSS totally, "they'll" think up something else to drive us mad!

[sm=rotfl.gif]
Have you read the article on the term "Jello" for css yet? All it basically is, is a different term for liquid layouts, that aren't totally liquid. And I think that this is what confuses people learning css.

I think that this is one thing that tends to bog people down with css. Too many terms to confuse everyone.




Tailslide -> RE: Container positioning (5/20/2005 11:34:21)

Yeah I read it. To be honest I've been using fixed layouts lately - less hassle!

The thing that really pains me is the cross-browser problem. Thank god for Browsercam I say - or some of my layouts would be WAY off.

New techniques are fine in themselves - if CSS was implemented the same cross-browser then it'd be lovely - "oh look, an new technique for me to use" but instead it's more a case of "oh god what happens in Mac IE or Konqueror"

Depressingly I see no change in the near future - even if the new IE is compliant - we'll be coding for b**** IE 5.5 for years. *sigh*




c1sissy -> RE: Container positioning (5/20/2005 11:45:24)

quote:

even if the new IE is compliant


I wouldn't hold my breath for that one. I have read articles (have to find them and post them in here) that say that the new IE isn't any more compliant then the one we have now.[&o]




slbergh -> RE: Container positioning (5/20/2005 11:48:36)

Awesome!! That fixed everything.

Tailslide, you're my hero!  [:D]




Tailslide -> RE: Container positioning (5/20/2005 11:49:44)

Oh well ain't that a big fat suprise - so that'll be the next 10 years fiddling with browser hacks. B****r!




Tailslide -> RE: Container positioning (5/20/2005 11:53:03)

quote:

ORIGINAL: slbergh

Awesome!! That fixed everything.

Tailslide, you're my hero! [:D]


Sorry! My reply above was to C1sissy - not you slbergh!! LOL!

Gosh - I've never been anyone's hero before! [:)]

Good - I'm glad it's fixed it (credibility on the line here you know). Just check that you know which bit's I've changed in your HTML code - otherwise it'll go horribly wrong when implemented on the other pages...





slbergh -> RE: Container positioning (5/20/2005 12:01:33)

I saw what you did and your help is much appreciated!




jaybee -> RE: Container positioning (5/20/2005 12:14:21)

quote:

Gosh - I've never been anyone's hero before!


Now you're in trouble. Just wait for the emails to start turning up. [:D]

quote:

Dear Tailslide,

I'm not a member of outfront but I saw your posting on....... and I've got a problem.





slbergh -> RE: Container positioning (5/20/2005 12:20:18)

quote:

Dear Tailslide,

I'm not a member of outfront but I saw your posting on....... and I've got a problem.


jaybee, you may have to give up (or rent out?) your caped avatar!

"Faster than broadband... more powerful than a standards compliant browser...It's Tailslide to the rescue!"




Tailslide -> RE: Container positioning (5/20/2005 12:21:52)

Oh dear.

Don't suppose I can just forward them onto you, oh fearless leader?







Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.1113281