Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Slices for layout in Photoshop, all screwed up with CSS 1

Status
Not open for further replies.

nofx1728

Technical User
Jan 26, 2006
65
US
Someone please help me! I'm using Dreamweaver 8. I build the layout in Photoshop, sliced up the images, and I'm using CSS for layout. This is what I'm trying to accomplish: Banner section, then content section. I want my maincontent and my leftside to be able to stretch. And then my footer, and then the bottom of my page.

You can view my page here:

It displays properly in explorer, *except the #maincontent section does not stretch them image, it repeats the image.

Html code:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<link href="concernedmain.css" rel="stylesheet" type="text/css" />
</head>

<body>
	<div id="container">
		<div id="header">
			<div id="flag">
			</div>
			<div id="rightflag">
			</div>
		</div>
		<div id="side">
			<div id="bottomflag">
		    </div>
			<div id="leftside">
			 
		    </div>
		</div>
		<div id="content">
		  <div id="topcontent">
		  </div>
		  <div id="maincontent">
		   
		  </div>
		 
		</div>
		<div id="footer">
		</div>
		<div id="bottompage">
		</div>
	</div>
</body>
</html>

CSS Code:
Code:
/* CSS Document */

body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000000;
background-color:#ffffff;
margin: 0px;
padding: 0px;
}

/*layout*/

#container {
background-color: #0F2E5D;
color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
margin: 0px auto;
width: 760px;
border-left: #000000 1px solid;
}

/*logo and header*/

#header {
background-color:#FFFFFF;
color: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
height: 93px;
float: left;
width: 760px;
}

#flag {
background-image: url(assets/top_flag.jpg);
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
height: 93px;
width: 200px;
float: left;
}

#rightflag {
background-image: url(assets/top_bg.jpg);
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
height: 93px;
width: 560px;
float: left;
}

/*end of header*/

/*side*/

#side {
background-color: #0F2E5D;
font-family: Verdana, Arial, Helvetica, sans-serif;
width: 200px;
float: left;
}

#bottomflag {
background-image: url(assets/bottom_flag.jpg);
width: 200px;
float: left;
height: 50px;
}

#leftside {
background-color: #0F2E5D;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
width: 200px;
float: left;
height: 355px;
}

/*end of side*/

/*content*/

#content {
background-color: #0F2E5D;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
width: 560px;
float: left;
}

#topcontent {
background-image: url(assets/top_content.jpg);
width: 560px;
height: 50px;
}

#maincontent {
background-image: url(assets/main_content.jpg);
width: 560px;
color: #000000;
height: 355px;
}

/*end of content*/

/*footer*/

#footer {
background-image: url(assets/cc_footer.jpg);
width: 760px;
height: 25px;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #FFFFFF;
}

/*end of footer*/

/*bottom page*/

#bottompage {
background-image: url(assets/bottom_page.jpg);
width: 760px;
height: 22px;
}

/*end of bottom page*/

/*text*/

p {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000000;
}
/*end of text*/

I know that I have the height set to 355px in the #leftside and #maincontent sections which is why the image repeats itself. However this is the only way I could get it to display properly. I need the #leftside and #maincontent to be identical in size, so the #footer lines up properly. Can someone please help me understand what I'm doing wrong? If you preview in Firefox or Opera it's not even close.

Thanks,

nofx1728
 
I don't really know what I am (not) seeing. Apart from no #footer, the page looks the same for me in IE6, Mozilla and Opera. You can get the footer by adding [tt]clear: both;[/tt] to its declaration. There's still the black gap, but that one exists in IE as well. Apart from that, I cannot see any problems. Or to say, it renders as I would expect it -- I can see a lot of arbitrary css declarations like floated top header albeit it has nothing to float against.
 
So what your saying is.. what you see..

At the top you see the entire flag, with the drop shadow. Then you see the watermark in its entirety in the content section?

When I previewed in Firefox and Opera the bottom of the content section would not display, and serveral other problems.

Also, How can I get it so the #maincontent sections background image stretches when more content is added, instead of repeating? Without the #leftside being messed up? I need #leftside and #maincontent to be identical in length, even if more content is inside the #maincontent section.

Thanks for your help, I appreciate your feedback.

Thanks,

nofx1728
 
For #footer not appearing in FF and Opera see my explanation above. For making the #leftside extend along the lines of maincontent, I suggest you look into faux columns. For background stretching, AFAIK you cannot do that. You can either repeat or not repeat the background. You cannot stretch it. Besides, stretching the image would make it look terrible, no? I think that should cover your questions for now.
 
Also, you say it doesn't appear for you - are you sure you have the most recent version of Firefox?

--- Specimen
 
I just made the changes, and now everything is appearing. However, now I have 3 unwanted gaps. You can see them in Firefox. They are blue, and you will see the drop shadow also end. They appear between #topcontent and #content. Between #content and #bottomcontent. And between #bottomcontent and #footer. I'm not sure why, I don't have any margins or paddings set for the div's. Also, it has a 1px blue line to the right of the page in both explorer and Firefox. This only appeared when I set my border-left - 1px. Including the 1px border the width of the page should equal 763px. Which is what my container is set to. But its not displaying correctly. I tried setting container to 762px and that 1px is still visible. Not sure why. Bellsouth usually changes the code so I'll post it back in here. You can view the site at :
html code
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<link href="concernedmain.css" rel="stylesheet" type="text/css" />
</head>

<body>
	<div id="container">
		<div id="header">
			<div id="flag">
			</div>
			<div id="rightflag">
			</div>
		</div>
		<div id="side">
			<div id="bottomflag">
		    </div>
			<div id="leftside">
			  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="[URL unfurl="true"]http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"[/URL] width="180" height="355" hspace="5" title="nav">
                <param name="movie" value="assets/cc_menu.swf" />
                <param name="quality" value="high" />
                <embed src="assets/cc_menu.swf" width="180" height="355" hspace="5" quality="high" pluginspage="[URL unfurl="true"]http://www.macromedia.com/go/getflashplayer"[/URL] type="application/x-shockwave-flash"></embed>
		      </object>
			</div>
		</div>
		<div id="content">
		  <div id="topcontent">
		  </div>
		  <div id="maincontent">
		  <h1>Indian River County</h1>
		  <p class="sectionTitle">MISSION STATEMENT</p>
<p>"To Promote accountability in government and an informed citizenry on issues that affect the economic vitality, livability, and quality of life in Indain River County." </p>

<p class="sectionTitle">ABOUT US</p>
<p>Concerned Citizens for the future of Indian River County is a diverse cross-section of local people who believe every citizen in Indian River County should have opportunities and a place to live, work and raise a family. We support the idea that it takes residents and businesses together to create a "community". Concerned Citizens was established as a non-profit organization which, initially, supported the Chamber's position that the City of Vero Beach move toward a vision process to provide information and direction for the future of the community. In April 2003 the organization was incorporated as a Committee of Continuing Existence. </p>

<p>Concerned Citizens for the future of Indian River County is a diverse cross-section of local people who believe every citizen in Indian River County should have opportunities and a place to live, work and raise a family. We support the idea that it takes residents and businesses together to create a "community". Concerned Citizens was established as a non-profit organization which, initially, supported the Chamber's position that the City of Vero Beach move toward a vision process to provide information and direction for the future of the community. In April 2003 the organization was incorporated as a Committee of Continuing Existence. </p>

		  </div>
		 
		</div>
		<div id="bottompage">
		</div>
		<div id="footer">
		<p class="footer">© 2005 Copyright Concerned Citizens For the Future of Indian River County. All Rights Reserved.<br />
4865 N. A1A | Vero Beach, FL 32963 | 772-234-5230 | Fax: 772-234-5208 | <a href="mailto: info@ccirc.org">info@ccirc.org</a> </p>
		</div>
	</div>
</body>
</html>

css code

Code:
/* CSS Document */

body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000000;
background-color:#ffffff;
margin: 0px;
padding: 0px;
}

/*layout*/

#container {
background-color: #0F2E5D;
color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
margin: 0px auto;
width: 763px;
border-left: #000000 1px solid;
}

/*logo and header*/

#header {
background-color:#FFFFFF;
color: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
height: 94px;
float: left;
width: 763px;
}

#flag {
background-image: url(assets/top_flag2.jpg);
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
height: 94px;
width: 195px;
float: left;
}

#rightflag {
background-image: url(assets/top_bg2.jpg);
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
height: 94px;
width: 567px;
float: left;
}

/*end of header*/

/*side*/

#side {
background-color: #0F2E5D;
font-family: Verdana, Arial, Helvetica, sans-serif;
width: 195px;
float: left;
}

#bottomflag {
background-image: url(assets/bottom_flag2.jpg);
width: 195px;
float: left;
height: 50px;
}

#leftside {
background-image: url(assets/left_side2.jpg);
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
width: 195px;
float: left;
height: 375px;
}

/*end of side*/

/*content*/

#content {
background-color: #0F2E5D;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
width: 567px;
float: left;
}

#topcontent {
background-image: url(assets/top_content2.jpg);
width: 567px;
height: 50px;
}

#maincontent {
background-image: url(assets/main_content2.jpg);
width: 567px;
color: #000000;
min-height:375px;
}


/*end of content*/

/*bottom page*/

#bottompage {
background-image: url(assets/cc_bottompage2.jpg);
width: 762px;
height: 35px;
clear: both;
}

/*end of bottom page*/

/*footer*/

#footer {
background-image: url(assets/cc_footer2.jpg);
width: 762px;
height: 25px;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #FFFFFF;
clear: both;
}

/*end of footer*/

/*text*/

p {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000000;
padding: 0px 20px 0px 10px;
}

.sectionTitle {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 16px;
color:#AE1705;
padding: 0px 10px;
}

h1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
text-align:center;
color: #0F2E5D;
}

.footer {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #FFFFFF;
text-align: center;
}

.footer a {
color: #FFFFFF;
text-decoration: underline;
}

.footer a:hover {
color: #AE1705;
}
/*end of text*/

Thanks for all of your help.

Thanks,

nofx1728
 
Why the gaps are appearing is nicely explained in this article. It is because of (default) margins of first <h1> and last <p> elements in the #maincontent and the <p> element in the #footer. Article will provide solutions for that.

Fixing the container size to 762px helps in my Mozilla. No more line. For the IE, that would be more difficult, as IE is less strict when it comes to obeying widths. You have 762px on the container and 763px on the header. IE will make your container 763px then to make sure header will fit there. Geckos will however keep the container at your desired width. So to fix the line in IE, you need to set the container width to 762px and then check all the elements that could be pushing the container to be bigger than that.
 
I don't know what to say Vragabond. I could have not figured this out without you. Your suggestions worked perfect, and everything is displaying properly! At least for now :). I usually declare all my elements margins to 0px; at the top, and forgot to do it, and it came back to haunt me. Thanks again for all of your help, it is much appreciated.

Thanks,

nofx1728
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top