PDA

View Full Version : Problem with main content not expanding? (Now IE compatiability issue)



JonisJon
Mar 2nd, 2009, 01:02 AM
Hey everyone,

I am having a problem with my site I am working on here:

www.fellowcitizensmusic.com/press.html

All my other pages seem to be working fine, but when there is not enough content in the main content div the rounded box does not expand to fit the page and leaves a blank white space to the right. Can anyone help me figure out how to set this so the rounded box will always fill the page no matter how little content is in there?

As always any help is greatly appreciated, thanks!

My CSS:


@charset "utf-8";
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
background: #FFF;
text-align: center;
color: #000000;
margin: 0;
padding: 0;
font-family: Verdana, Geneva, sans-serif;
}

.oneColElsCtrHdr #container {
border: 1px solid #000000;
text-align: left;
background-color: #FFF;
margin: auto;
}
.oneColElsCtrHdr #header h1 {

}
.oneColElsCtrHdr #mainContent {
background-color: #CCC;
padding: 0 40px;
}

#mainContent {
font-family: "Rockwell Extra Bold";
font-size: 100%;
font-style: normal;
color: #FFF;
text-align: center;
float: none;
clear: none;
top: 210px;
position: absolute;
left: 0px;
}
#header {
background-color: #FFF;
top: 0px;
background-repeat: repeat-x;
left: 0px;
width: 100%;
height: 60px;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
background-image: url(../images/Header_Bg2.jpg);
overflow: hidden;
position: absolute;
}
#footer {
background-color: #CCC;
width: 100%;
height: 200px;
}
#footer P {
color: #FFF;
text-align: center;
}


#header ul {
list-style-type: none;
font-size: 20px;
color: #FFF;
font-weight: bold;
position: absolute;
top: 0;
clear: right;
padding-left: 2.5em;
left: 40px;
float: left;
}
#header li {
display: inline;
margin-right: 1em;
overflow: hidden;
}
#header a {
font-size: 100%;
color: #000;
text-decoration: none;
padding-top: 2px;
padding-right: 15px;
padding-bottom: 2px;
padding-left: 15px;
}


#masthead {
background-position: center;
position: absolute;
width: 100%;
left: 0px;
top: 60px;
}
.box {
background-color: #000;
clear: left;
height: 100%;
width: 100%;
}
.boxtop {
background-image: url(../images/ne.gif);
background-repeat: no-repeat;
background-position: right top;
text-align: left;
}
.boxtop div {
background-image: url(../images/nw.gif);
background-repeat: no-repeat;
background-position: left top;
height: 50px;
font-size: 0px;
width: 50px;
}
.boxbottom {
background-image: url(../images/se.gif);
background-repeat: no-repeat;
background-position: right bottom;
text-align: center;
}
.boxbottom div {
font-size: 0px;
height: 50px;
background-image: url(../images/sw.gif);
background-repeat: no-repeat;
background-position: left bottom;
width: 50px;
}
.boxcontent {
padding: 0px 50px 0px 50px;
}

Excavator
Mar 2nd, 2009, 03:51 AM
Hello JonisJon,
When you don't give a width to #mainContent it sizes itself to it's content... an odd behavior that seems cause by the absolute positioning? Not sure about that.
This works to fix it -
#mainContent {
font-family: "Rockwell Extra Bold";
font-size: 100%;
font-style: normal;
color: #FFF;
text-align: center;
margin: 210px 0 0 0;
}
or this -
#mainContent {
font-family: "Rockwell Extra Bold";
font-size: 100%;
font-style: normal;
color: #FFF;
text-align: center;
top: 210px;
position: absolute;
left: 0px;
width: 100%;
}


Good job on the valid CSS/XHTML !!:thumbsup:

JonisJon
Mar 2nd, 2009, 04:26 AM
Thank you excavator. I took your code and it didn't work as first, but I just had to adjust a few more small elements, and adjusting the padding of the box to get it to work correctly. Thanks for the help and the nod on the valid code... I made sure to validate everything before i submitted it on here.

JonisJon
Mar 2nd, 2009, 04:31 AM
However, after I fixed it, is showing up fine in firefox, but all warped in IE. Check out the differences in the apperance, of this link between the two browsers: www.fellowcitizensmusic.com/news.html

Any ideas on what may be causing this IE bug?

my updated CSS:



@charset "utf-8";
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
background: #FFF;
text-align: center;
color: #000000;
margin: 0;
padding: 0;
font-family: Verdana, Geneva, sans-serif;
}

.oneColElsCtrHdr #container {
border: 1px solid #000000;
text-align: left;
background-color: #FFF;
margin: auto;
}
.oneColElsCtrHdr #header h1 {

}
.oneColElsCtrHdr #mainContent {
background-color: #CCC;
}

#mainContent {
font-family: "Rockwell Extra Bold";
font-size: 100%;
font-style: normal;
color: #FFF;
text-align: center;
top: 210px;
position: absolute;
left: 0px;
width: 100%;
}
#header {
background-color: #FFF;
top: 0px;
background-repeat: repeat-x;
left: 0px;
width: 100%;
height: 60px;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
background-image: url(../images/Header_Bg2.jpg);
overflow: hidden;
position: absolute;
}
#footer {
background-color: #CCC;
width: 100%;
height: 200px;
}
#footer P {
color: #FFF;
text-align: center;
}


#header ul {
list-style-type: none;
font-size: 20px;
color: #FFF;
font-weight: bold;
position: absolute;
top: 0;
clear: right;
padding-left: 2.5em;
left: 40px;
float: left;
}
#header li {
display: inline;
margin-right: 1em;
overflow: hidden;
}
#header a {
font-size: 100%;
color: #000;
text-decoration: none;
padding-top: 2px;
padding-right: 15px;
padding-bottom: 2px;
padding-left: 15px;
}


#masthead {
background-position: center;
position: absolute;
width: 100%;
left: 0px;
top: 60px;
}
.box {
background-color: #000;
clear: left;
height: 100%;
width: 90%;
left: 60px;
position: relative;
}
.boxtop {
background-image: url(../images/ne.gif);
background-repeat: no-repeat;
background-position: right top;
text-align: left;
}
.boxtop div {
background-image: url(../images/nw.gif);
background-repeat: no-repeat;
background-position: left top;
height: 50px;
font-size: 0px;
width: 50px;
}
.boxbottom {
background-image: url(../images/se.gif);
background-repeat: no-repeat;
background-position: right bottom;
text-align: center;
}
.boxbottom div {
font-size: 0px;
height: 50px;
background-image: url(../images/sw.gif);
background-repeat: no-repeat;
background-position: left bottom;
width: 50px;
}
.boxcontent {
padding: 0px 50px 0px 50px;
}

abduraooft
Mar 2nd, 2009, 09:47 AM
Please format code in your posts using the
][/COLOR] tag! (http://www.codingforums.com/showthread.php?t=82672). You may edit your above post.

JonisJon
Mar 2nd, 2009, 06:11 PM
There ya go, reformatted... sorry about that, I am still having this problem with IE, anyone have any ideas?

abduraooft
Mar 3rd, 2009, 08:28 AM
I think, we had fixed a similar issue at http://www.codingforums.com/showthread.php?t=159791

JonisJon
Mar 3rd, 2009, 11:17 AM
I took of the width settings of the box divs, that seems to have solved the problem. However I have to set the padding of the .box to only 20px (and i would like closer to 60), but otherwise it will be off the page in IE.

Excavator
Mar 3rd, 2009, 07:23 PM
Hello JonisJon,
Try this for .box

.box {
background-color: #fff;
position: relative;
width: 95%;
margin: 0 auto;
}
If padding .box is giving you trouble you can always add margin to the content of .box to move it away from the edges.
Could also center a container div in there with no background color to keep things lined up.

JonisJon
Mar 4th, 2009, 01:54 AM
That worked quite nicely, thanks for the fix excavator, it looks a lot better using that margin code than using padding.