Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-26-2008, 05:03 PM   PM User | #1
stefonia
New to the CF scene

 
Join Date: Jan 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
stefonia is an unknown quantity at this point
DIV background-image is not showing up

My entire website is structured with DIV and in the footer are two more float:left DIV to separate some text. I placed a background image in my footer DIV and mainContent DIV but they won't show up. While the background image in my header DIV did.
Any help would be appreciated!

STYLESHEET
Code:
@charset "UTF-8";
body {
	font: 100% Verdana, Arial, Helvetica, sans-serif;
	background: #666666;
	margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
	padding: 0;
	text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
	color: #000000;
}

/* Tips for Elastic layouts 
1. Since the elastic layouts overall sizing is based on the user's default fonts size, they are more unpredictable. Used correctly, they are also more accessible for those that need larger fonts size since the line length remains proportionate.
2. Sizing of divs in this layout are based on the 100% font size in the body element. If you decrease the text size overall by using a font-size: 80% on the body element or the #container, remember that the entire layout will downsize proportionately. You may want to increase the widths of the various divs to compensate for this.
3. If font sizing is changed in differing amounts on each div instead of on the overall design (ie: #sidebar1 is given a 70% font size and #mainContent is given an 85% font size), this will proportionately change each of the divs overall size. You may want to adjust based on your final font sizing.
*/
.columns #topborder {
	width: 100%;  /* this width will create a container that will fit in an 800px browser window if text is left at browser default font sizes */
	height: 5px;
	background: #0099FF;
	margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
	text-align: left; /* this overrides the text-align: center on the body element. */
}
.columns #container {
	width: 100%;  /* this width will create a container that will fit in an 800px browser window if text is left at browser default font sizes */
	height: 100%; 
	background: #FFFFFF;
	margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
	text-align: left; /* this overrides the text-align: center on the body element. */
}
.columns #header { 
	background: #000000;  
	background-image: url(header_bg.jpg);
	background-attachment: fixed;
	background-repeat: no-repeat;
	padding: 1% 18% 1% 18%; 
	height: 70px; 
} 
.columns #header h1 {
	margin: 0; 
	padding: 10px 0;
	color: #FFFFFF;
	font-size: 40px;
}
.columns #lheader { 
	padding-top: 1%;
	padding-bottom: 1%;
	margin: 0; 
	width: 308px;
	float:left;
	text-align: right;
}
.columns #rheader { 
	padding-top: 1%;
	padding-bottom: 1%;
	margin: 0; 
	width: auto;
	float:right;
	height: 70px;
	text-align: right;
} 
.columns #rheader a:link, a:visited, a:active {
	font-size: 13px;
	padding: 5px;
	font-weight: bold;
	color: #999999;
	text-decoration:none; 
} 
.columns #rheader a:hover {
	text-decoration:none;
	padding:5px;
	color: #FFFFFF; 
	background-color: #666666;
	-moz-border-radius: 4px;
} 
.columns #feature {
	background:#A5F900;
	background-image: url(feature.jpg);
	height: auto;
	padding: 1% 18% 1% 18%; 
}
.columns #feature  p{
	color: #FFFFFF; 
	font-weight: bold;
	font-size: 15px;
	margin: 0;
	padding: 10px 0px;
}
.columns #mainContent {
	padding: 1% 18% 1% 18%;
	background-image: url(content_bg.jpg);
	vertical-align:top;
	background-attachment: fixed;
	background-repeat: no-repeat;
	background: #FFFFFF;
	height: auto; 
}
.columns #footer {
	padding: 0 18% 0 18%;
	background-image: url(footer_bg.jpg);
	background-repeat: no-repeat;
	background-attachment: fixed;
	font-size:12px;
	height: auto;
	line-height: 20px;
	color: #999999;
} 
.columns #lfooter {
	padding-top: 1%;
	padding-bottom: 1%;
	background-color: transparent;
	margin: 0; 
	width: 70%;
	float: left;
}
.columns #rfooter {
	padding-top: 1%;
	padding-bottom: 1%;
	background-color: transparent;
	margin: 0; 
	width: 30%;
	float: left;
	text-align: right;
}
.columns #footer a:link, a:visited, a:active {
	text-decoration:none; 
	color: #999999;
} 
.columns #footer a:hover {
	text-decoration:none;
	color: #FFFFFF; 
}

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=UTF-8" />
<title>Same Choice Printing Products | Hong Kong</title>
<link href="oneColElsCtrHdr.css" rel="stylesheet" type="text/css" />
</head>

<body class="columns">

<div id="container">
<div id="topborder"></div>
  <div id="header">
  	<div id="lheader">
    <img src="logo_text.png" alt="Same Choice">
    </div>
    <div id="rheader">
      <p>
      <a href="index.html">Home</a>&nbsp;&nbsp;
      <a href="about.html">About Us</a>&nbsp;&nbsp;
      <a href="products.html">Our Products</a>&nbsp;&nbsp;
      <a href="contact.html">Contact Us</a>
      </p>
    </div>
  </div>
    <div id="feature">
    <p>images images images, featured abstract</p>
 
 </div>
  <div id="mainContent">
    <h1> Main Content </h1>
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam,  justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam  ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo  porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis  ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean  sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at,  odio. Donec et ipsum et sapien vehicula nonummy. Suspendisse potenti. Fusce  varius urna id quam. Sed neque mi, varius eget, tincidunt nec, suscipit id,  libero. In eget purus. Vestibulum ut nisl. Donec eu mi sed turpis feugiat  feugiat. Integer turpis arcu, pellentesque eget, cursus et, fermentum ut,  sapien. Fusce metus mi, eleifend sollicitudin, molestie id, varius et, nibh.  Donec nec libero.</p>
    <h2>H2 level heading </h2>
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam,  justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam  ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo  porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis  ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean  sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio.</p>
	</div>
  <div id="footer">
  	<div id="lfooter">
    <p>
    		<a href="index.html" alt="Home">Home</a> | 
   			<a href="about.html" alt="About Us">About Us</a> | 
    		<a href="products.html" alt="OEM">Our Products</a> |
   	 		<a href="contact.html" alt="Contact Us"> Contact Us</a><br>
            &copy; Same Choice Printing Products Co. Ltd
     </p>
   	</div>
    <div id="rfooter">
   		<p>
        	(852) 2950 1388<br>
    		<a href="contact.html" alt="Contact Us">enquiry@samechoice.com</a>
   		</p>
    </div>
  </div>
</div>
</body>
</html>
stefonia is offline   Reply With Quote
Old 01-26-2008, 05:35 PM   PM User | #2
medigerati
Regular Coder

 
medigerati's Avatar
 
Join Date: Jul 2005
Location: San Antonio, Tx
Posts: 163
Thanks: 0
Thanked 7 Times in 7 Posts
medigerati is on a distinguished road
Because the two divs inside the footer are floated, the footer div won't have a height. Either float the footer also, or add a clearfix.

http://www.456bereastreet.com/archiv...eeded_for_ie7/
__________________
If you need a little more help, I'm available as a Website designer in San Antonio
----------
If I've helped, please check out my friend's nature photography and let me know if you like anything.
medigerati is offline   Reply With Quote
Old 01-26-2008, 05:35 PM   PM User | #3
effpeetee
Senior Coder

 
effpeetee's Avatar
 
Join Date: Feb 2007
Location: Clapham Junction - London SW
Posts: 4,884
Thanks: 228
Thanked 204 Times in 203 Posts
effpeetee is an unknown quantity at this point
The assembled code for anyone interested. Frank

Also here: http://www.exitfegs.co.uk/atest.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=UTF-8" />
<title>Same Choice Printing Products | Hong Kong</title>
<style type="text/css">

@charset "UTF-8";
body {
	font: 100% Verdana, Arial, Helvetica, sans-serif;
	background: #666666;
	margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
	padding: 0;
	text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
	color: #000000;
}

/* Tips for Elastic layouts 
1. Since the elastic layouts overall sizing is based on the user's default fonts size, they are more unpredictable. Used correctly, they are also more accessible for those that need larger fonts size since the line length remains proportionate.
2. Sizing of divs in this layout are based on the 100% font size in the body element. If you decrease the text size overall by using a font-size: 80% on the body element or the #container, remember that the entire layout will downsize proportionately. You may want to increase the widths of the various divs to compensate for this.
3. If font sizing is changed in differing amounts on each div instead of on the overall design (ie: #sidebar1 is given a 70% font size and #mainContent is given an 85% font size), this will proportionately change each of the divs overall size. You may want to adjust based on your final font sizing.
*/
.columns #topborder {
	width: 100%;  /* this width will create a container that will fit in an 800px browser window if text is left at browser default font sizes */
	height: 5px;
	background: #0099FF;
	margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
	text-align: left; /* this overrides the text-align: center on the body element. */
}
.columns #container {
	width: 100%;  /* this width will create a container that will fit in an 800px browser window if text is left at browser default font sizes */
	height: 100%; 
	background: #FFFFFF;
	margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
	text-align: left; /* this overrides the text-align: center on the body element. */
}
.columns #header { 
	background: #000000;  
	background-image: url(header_bg.jpg);
	background-attachment: fixed;
	background-repeat: no-repeat;
	padding: 1% 18% 1% 18%; 
	height: 70px; 
} 
.columns #header h1 {
	margin: 0; 
	padding: 10px 0;
	color: #FFFFFF;
	font-size: 40px;
}
.columns #lheader { 
	padding-top: 1%;
	padding-bottom: 1%;
	margin: 0; 
	width: 308px;
	float:left;
	text-align: right;
}
.columns #rheader { 
	padding-top: 1%;
	padding-bottom: 1%;
	margin: 0; 
	width: auto;
	float:right;
	height: 70px;
	text-align: right;
} 
.columns #rheader a:link, a:visited, a:active {
	font-size: 13px;
	padding: 5px;
	font-weight: bold;
	color: #999999;
	text-decoration:none; 
} 
.columns #rheader a:hover {
	text-decoration:none;
	padding:5px;
	color: #FFFFFF; 
	background-color: #666666;
	-moz-border-radius: 4px;
} 
.columns #feature {
	background:#A5F900;
	background-image: url(feature.jpg);
	height: auto;
	padding: 1% 18% 1% 18%; 
}
.columns #feature  p{
	color: #FFFFFF; 
	font-weight: bold;
	font-size: 15px;
	margin: 0;
	padding: 10px 0px;
}
.columns #mainContent {
	padding: 1% 18% 1% 18%;
	background-image: url(content_bg.jpg);
	vertical-align:top;
	background-attachment: fixed;
	background-repeat: no-repeat;
	background: #FFFFFF;
	height: auto; 
}
.columns #footer {
	padding: 0 18% 0 18%;
	background-image: url(footer_bg.jpg);
	background-repeat: no-repeat;
	background-attachment: fixed;
	font-size:12px;
	height: auto;
	line-height: 20px;
	color: #999999;
} 
.columns #lfooter {
	padding-top: 1%;
	padding-bottom: 1%;
	background-color: transparent;
	margin: 0; 
	width: 70%;
	float: left;
}
.columns #rfooter {
	padding-top: 1%;
	padding-bottom: 1%;
	background-color: transparent;
	margin: 0; 
	width: 30%;
	float: left;
	text-align: right;
}
.columns #footer a:link, a:visited, a:active {
	text-decoration:none; 
	color: #999999;
} 
.columns #footer a:hover {
	text-decoration:none;
	color: #FFFFFF; 
}
</style>
</head>

<body class="columns">

<div id="container">
<div id="topborder"></div>
  <div id="header">
  	<div id="lheader">
    <img src="logo_text.png" alt="Same Choice">
    </div>
    <div id="rheader">
      <p>
      <a href="index.html">Home</a>&nbsp;&nbsp;
      <a href="about.html">About Us</a>&nbsp;&nbsp;
      <a href="products.html">Our Products</a>&nbsp;&nbsp;
      <a href="contact.html">Contact Us</a>
      </p>
    </div>
  </div>
    <div id="feature">
    <p>images images images, featured abstract</p>
 
 </div>
  <div id="mainContent">
    <h1> Main Content </h1>
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam,  justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam  ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo  porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis  ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean  sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at,  odio. Donec et ipsum et sapien vehicula nonummy. Suspendisse potenti. Fusce  varius urna id quam. Sed neque mi, varius eget, tincidunt nec, suscipit id,  libero. In eget purus. Vestibulum ut nisl. Donec eu mi sed turpis feugiat  feugiat. Integer turpis arcu, pellentesque eget, cursus et, fermentum ut,  sapien. Fusce metus mi, eleifend sollicitudin, molestie id, varius et, nibh.  Donec nec libero.</p>
    <h2>H2 level heading </h2>
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam,  justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam  ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo  porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis  ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean  sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio.</p>
	</div>
  <div id="footer">
  	<div id="lfooter">
    <p>
    		<a href="index.html" alt="Home">Home</a> | 
   			<a href="about.html" alt="About Us">About Us</a> | 
    		<a href="products.html" alt="OEM">Our Products</a> |
   	 		<a href="contact.html" alt="Contact Us"> Contact Us</a><br>
            &copy; Same Choice Printing Products Co. Ltd
     </p>
   	</div>
    <div id="rfooter">
   		<p>
        	(852) 2950 1388<br>
    		<a href="contact.html" alt="Contact Us">enquiry@samechoice.com</a>
   		</p>
    </div>
  </div>
</div>
</body>
</html>>
__________________
* Sources (updated: 21.11.2012.
Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

Last edited by effpeetee; 01-26-2008 at 05:38 PM..
effpeetee is offline   Reply With Quote
Old 01-28-2008, 11:57 AM   PM User | #4
stefonia
New to the CF scene

 
Join Date: Jan 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
stefonia is an unknown quantity at this point
thanks the clearfix did work for the footer.
i added the same clearfix property together with display:inline-block to the DIV container mainContents and display:block to the two floats inside the container, but the container did not expand to wrap the floats inside it. any suggestions?

again, thanks in advance!
stefonia is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:12 PM.


Advertisement
Log in to turn off these ads.