Forum Moderators: not2easy

Message Too Old, No Replies

My CSS is driving me Nuts

         

mufc

9:38 pm on Jan 16, 2007 (gmt 0)

10+ Year Member



My web site is causing me problems with CSS since I have reworked it.
If you look at my web pages in Internet Explorer they look perfect. In Firefox when loading some of the pages the top logo blinks and takes a few seconds to load. In Opera some pages move slightly to the right.
I know the problem is related to the length of the center div but I have no idea how to fix this unless I make the small centers longer.
Also my previous version of this site just used one image. Logo.gif was in the background.
I have put Logo.gif in the header and have used GREEN.jpg as my background now.
MY CSS
body {
background-image: url(../images/GREEN.jpg);
}
div.container {
position: relative;
margin: 0 auto;
width: 746px;
height: 840px;
}
#header {
height: 100px;
width: 746px;
background-image: url(../images/Logo.gif);
background-repeat: no-repeat;
background-position: 50% 0%;
}
#nav {
position: absolute;
top: 110px;
left: 55px;
height: 20px;
width: 640px;
}
#left {
position: absolute;
top: 160px;
left: 0px;
width: 124px;
}
#center {
position: absolute;
top: 160px;
left: 130px;
width: 441px;
height: auto;
border: solid;
}
/* right div at this time has been made invisible. Maybe later add Flash content*/
#right {
position: absolute;
top: 160px;
left: 600px;
width: 130px;
height: 100px;
}
/* this div belongs on photo pages and shows the alphabet on the right.Takes place of right div */
#navalpha {
position: absolute;
top: 160px;
left: 600px;
width: 100px;
height: 130px;
font-family: "Courier New", Courier, monospace;
border: solid;
}
/* Start of Top Menu*/
ul {
list-style: none;
margin: 0;
padding: 0;
font-size: .95em;

}

ul li {
float: left;
margin: 0;
padding: 0;
}
ul li a {
color: #777;
display: block;
text-align: center;
text-decoration: none;
width: auto;
padding: 3px 5px 3px 5px;
border-color: #191970;
border-width: 1px 1px 1px 0;
border-style: solid;
}
ul li.first a {
border-width: 1px;
}

ul li a:hover {
background-color: Fuchsia;
color: Yellow;
}
/* end of Top Menu*/
/* start of side Menu*/
ul#navlist
{
width: 102px;
padding: 0px;
margin: 0px;
border-left: thin solid Black;
font-size: .95em;
float: left;
}
ul#navlist li
{
list-style: none;
margin: 0px;
border: 0px;
}

ul#navlist li a
{
color: #777;
width: 102px;
padding: 2px 8px 2px 8px;
border-color: #191970;
border-width: 0px 1px 1px 0;
border-style: solid;
text-decoration: none;
text-align: left;
}
ul#navlist li.topfirst a {
border-top: 1px solid Black;
}
ul#navlist li a:link { color: Blue;
}
ul#navlist li a:hover
{
border-color: #191970;
color: Red;
background: Yellow;
}
ul#navlist li a:visited {
color: Blue;
}
/* end of side Menu*/
p {
text-align: left;
margin: 0 10px 0 10px;
}
h1 {
font-size: 1.05em;
color: Navy;
text-decoration: underline;
font-style: italic;
font-weight: bold;
font-variant: small-caps;
padding: 0px 0 6px 19px;
border-bottom: 1px dashed navy;
background: url(cube.gif) no-repeat 0 2px;
margin: 0 10px 0 10px;
}
h2 {
font-size: 1em;
color: Navy;
text-decoration: underline;
font-style: italic;
font-weight: bold;
font-variant: small-caps;
margin: 0 10px 0 10px;
}
h3 {
font-size: .9em;
color: Navy;
text-decoration: underline;
font-style: italic;
font-weight: bold;
font-variant: small-caps;
margin: 0 10px 0 10px;
}
a:link {
color: #0000FF;
text-decoration: none;
}
a:visited {
color: #0000FF;
text-decoration: none;
}
a:hover {
color: Red;
text-decoration: none;
}
a:active {
text-decoration: none;
}
/*
....................thumbnail determines how the small photos look
*/
.thumbnail
{
float: left;
width: 83px;
height: 115px;
border: 1px solid #999;
margin: 0px 15px 5px 0;
padding: 5px;
}
/*
.................thumbnailUnitBoard determines how the photos look on Unit Board page
*/
.thumbnailUnitBoard
{
float: left;
width: 220px;
margin: 0px 15px 15px 0;
padding: 5px;
}

[edited by: encyclo at 10:54 pm (utc) on Jan. 16, 2007]
[edit reason] no links to personal sites please, see forum charter [/edit]

mep00

8:15 pm on Jan 20, 2007 (gmt 0)

10+ Year Member



Not seeing the HTML structure makes diagnosing the problem more difficult, though I think I could guess at most of it.

If you look at my web pages in Internet Explorer they look perfect.
As a rule of thumb, it's better to first develop using a standards compliant browser and then fix for IE. (while no browser is currently in perfect compliance, Firefox, Opera, Konqueror, and Safari are all close enough).

In Opera some pages move slightly to the right.
I'm not sure, but it sounds like an issue related to whether or not there is a scroll bar.

I know the problem is related to the length of the center div but I have no idea how to fix this unless I make the small centers longer.
Why? Since the columns are positioned absolutely, they are taken out of the documents flow and have no effect on anything which isn't a descendant other than covering it Since there's usually no way to know how tall a column of text will be (the user can change the font sizes), there is no way to know (with css) how tall it needs to be. Speaking of absolute positioning, I find it's usually better to avoid using it for major parts of a document. While there are exceptions, those should be handled with care. I find floats better to work with.

There's a good article at positioniseverything.net, called "In Search of the one true Layout," which might be useful.