CSS layout issue

Danis[h]

New Member
Reaction score
19
I've used Divs to style a new website layout I am working on.
I have however encountered a problem:

http://www.bc.silwing.dk/guild

If you open the site in firefox, the content box's background does not stretch to fit the div it's containing when the text goes over its bounds.

However if you open it in internet explorer, it does..

Can anyone help me solve my css/divs so that the content does stretch. I made the two divs inside the content body to make "columns" for the different text.

My stylesheet is as follows:
Code:
body				{
						background-color:					black;
						padding:							0px;
						margin:								0px;
					}
.upper				
					{
						background-color:					white;
						background-image:					url("../images/upper.jpg");
						background-repeat:					repeat-x;
						position:							relative;
						top:								0px;
						width:								100%;
						height:								30px;
						text-align:							center;
						color:								#fbba6d;
						font-size:							14pt;
						font-weight:						bold;
					}

.upper a			
					{
						color:								#fbba6d;
						text-decoration:					none;
						display:							inline;
					}

.upper a:hover		
					{
						text-decoration:					underline;
					}

.content			
					{
						width:								916px;
						margin:								auto;
						position:							relative;
					}

.header				
					{
						background-image:					url("../images/header.jpg");
						background-repeat:					no-repeat;
						width:								916px;
						height:								175px;
						position:							relative;
					}
					
.grad-left
					{
						background-image:					url("../images/side-gradiant.jpg");
						background-repeat:					repeat-y;
						width:								169px;
						height:								100%;
						position:							absolute;
						left:								0px;
						z-index:							-1;
					}

.grad-right
					{
						background-image:					url("../images/side-gradiant.jpg");
						background-repeat:					repeat-y;
						width:								169px;
						height:								100%;
						background-color:					white;
						position:							absolute;
						right:								0px;
						z-index:							-1;
					}
.cont-body
					{
						background-color:					white;
						background-image:					url("../images/body-bg.jpg");
						min-height:							600px;
						width:								916px;
						background-repeat:					repeat-y;
						position:							relative;
					}
.main-cont
					{
						position:							relative;
						border-right:						3px solid #1c1a1a;
						width:								550px;
						min-height:							600px;
						height:								100%;
						float:								left;
						color:								white;
						font-size:							12pt;
					}
.second-cont
					{
						position:							relative;
						float:								left;
						min-height:							600px;
						width:								357px;
						color:								white;
						font-size:							12pt;
					}

p					
					{
						padding-left:						10px;
						padding-right:						10px;
					}		
					
.footer
					{
						position:							relative;
						width:								916px;
						height:								30px;
						background-image:					url("../images/footer.jpg");
						background-repeat:					repeat-x;
					}
					
h1
					{
						color:								#497ddb;
						width:								400px;
						font-size:							26pt;
						padding-left:						12px;
						margin:								8px;
						font-family:						arial narrow;
					}
					
h2
					{
						color:								#497ddb;
						width:								200px;
						font-size:							20pt;
						padding-left:						10px;
						margin:								8px;
						font-family:						arial narrow;
					}

and my HTML
Code:
<!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">

<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
	<meta name="author" content="Telariev" />
	<link rel="stylesheet" type="text/css" href="include/style.css" />
	<title>Evanescent</title>
</head>

<body>

<div class="grad-left">
</div>
<div class="grad-right">
</div>

	<div class="upper">
		<a href="#"> Home </a> | <a href="#"> Link 1 </a> | <a href="#"> Link 2 </a> | <a href="#"> Link 3 </a> | <a href="#"> Link 4 </a> | 
		<a href="#"> Link 5 </a> | <a href="#"> Link 6 </a> 
	</div>
	<div class="content">
		
		<div class="header">
		</div>
		
		<div class="cont-body">
			<div class="main-cont">
				<h1>Innocuous title</h1>
				<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur</p><p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur</p>
				<h1>Another Title</h1>
				<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur<br />Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa sectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur</p>
			</div>
			
			<div class="second-cont">
				<h2>Latest News</h2>
				<p>Sed ut perspiciatis ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur<br />Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim </p>
			</div>
		</div>
		
		<div class="footer">
		</div>
	</div>
</body>
</html>

Update:
There is also the issue of the small images (that are to be replaced by some repeating pattern) out in the left and right side doesn't continue down when the page becomes longer from the content.
 

Monovertex

Formerly Smith_S9
Reaction score
1,461
You need to remove the fixed height on the respective divs. Also, remove the 100% height on the divs that contain your background image.

In Firefox, there is a way to specify a minimum height and the div will stretch, if the text goes over that height, but that is not supported by IE.

However, if the text is not longer than the page's height, the background will not go all the way to the bottom. If you want a full-page background, make a seamless pattern and use it as a background-image on the body element.
 

UndeadDragon

Super Moderator
Reaction score
447
The use of absolute positions will mean that the footer div will not move further down the page when the text reaches it.
 

Danis[h]

New Member
Reaction score
19
The use of absolute positions will mean that the footer div will not move further down the page when the text reaches it.

the footer is position: relative though

Also these are the three divs that are causing the problem
Code:
.cont-body
					{
						background-color:					white;
						background-image:					url("../images/body-bg.jpg");
						min-height:							600px;
						width:								916px;
						background-repeat:					repeat-y;
						position:							relative;
					}
.main-cont
					{
						position:							relative;
						border-right:						3px solid #1c1a1a;
						width:								550px;
						min-height:							600px;
						height:								100%;
						float:								left;
						color:								white;
						font-size:							12pt;
					}
.second-cont
					{
						position:							relative;
						float:								left;
						min-height:							600px;
						width:								357px;
						color:								white;
						font-size:							12pt;
					}

What I've done is that I have put .cont-body in for the background image and within .cont-body I use .main-cont and .seond-cont to control the text columns layout.
However when .main-cont becomes longer than .cont-body... cont-body doesn't stretch to fit.
 

UndeadDragon

Super Moderator
Reaction score
447
the footer is position: relative though

Oh sorry, I missed all the values, because they are tabbed extremely far to the right :p
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
Add "clear: both;" to the .footer and add "float: left;" to the .cont-body. That should do it. You can remove the relative positioning on pretty much everything. If you want a more solid solution you should check out the various 2 column layout tutorials on the web.
 

Danis[h]

New Member
Reaction score
19
Add "clear: both;" to the .footer and add "float: left;" to the .cont-body. That should do it. You can remove the relative positioning on pretty much everything. If you want a more solid solution you should check out the various 2 column layout tutorials on the web.

Thank you, this solved the issue!
Could you elaborate on what you mean by more solid solution? I'm still new to the whole CSS layout thing.
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
Could you elaborate on what you mean by more solid solution? I'm still new to the whole CSS layout thing.
It seems like your current css has been developed using the "throw stuff at it until it works" methodology (eg, most of the relative positioning doesn't have any effect). Nothing wrong with that when you're learning, but if you want something that is expected to work on many browsers then you need something that's not working by a coincidence (and a little help).
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
A nice addition: If you want to have a minimum height that's crossbrowser, use this:

Code:
div#someDiv {
    height: THE_HEIGHT px;
    height: auto !important;
    min-height: THE_HEIGHT px;
}
 
General chit-chat
Help Users
  • The Helper The Helper:
    I just got to watch the video because even though I was there I was trying to work out tech problems with the chat since I was the social media guy so I was distracted but check it out guys the video is super fucking great!
    +1
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top