Forum Moderators: not2easy

Message Too Old, No Replies

Layout Problems CSS

         

Jgrnet

8:01 pm on Feb 29, 2008 (gmt 0)

10+ Year Member



OK IN IE glass.jpg is under the menu and centered and in FF glass.jpg is on the right of menu and centered how to fix this bug please? I want glass jpg to be center of page right of menu in both browsers.

After the above is fixed I want background_ft.jpg to always be at the bottom with no scroll. Since glass.jpg is behaving different in each browser the stickfooter fix I used make scrolling down the page go down too far.

If you may also check if I should change anything else in my code or how I could do things better.

THANKS IN ADVANCE!

/* CSS Document */

* {
margin: 0;
padding: 0;
list-style: none;
}
img {
border:none;
}
a img {
border: none;
}
a:active {
outline: none;
}
a:focus {
-moz-outline-style: none;
}
html, body {
height: 100%;
}
body {
font-size:12px;
font-family:Verdana, Arial, Helvetica, sans-serif;
background:url(../images/clearwater_bg.jpg) #FFFFFF no-repeat center top;
}
#container {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -200px; /* the bottom margin is the negative value of the footer's height */
}
#logo {
width:400px;
height:100px;
margin:25px auto 0 25px;
background:url(../images/crystal.png) no-repeat center;
}
#menu {
margin: 25px auto 0 25px;
width:206px;
}
#menu ul {
margin:0;
padding:0;
display: block;
}
#menu ul li {
display: block;
float: left;
}
#menu ul li a {
display: block;
text-decoration: none;
}
#menu ul li a:hover, #menu ul li a:active, #menu ul li a:focus, #menu ul li a.selected {
}
#main {
margin: 0 auto;
width:175px;
height:270px;
background:url(../images/glass.jpg) no-repeat center;
}
#menubottom {
margin: 0 auto 0 auto;
height:28px;
width:960px;
}
#menubottom ul {
margin:0;
padding:0;
list-style:none;
display: inline;
}
#menubottom ul li {
display: inline;
float: left;
}
#menubottom ul li a {
/*padding-bottom:10px;*/
display: block;
text-decoration: none;
}
#menubottom ul li a:hover, #menubottom ul li a:active, #menubottom ul li a:focus, #menubottom ul li a.selected {
/*background:url(images/nav_hover.png) 50% 0;*/
}
.footer {
background:url(../images/clearwater_ft.jpg) no-repeat bottom center;
}
.footer, .push {
height: 200px; /* .push must be the same height as .footer */
}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
Systems!" />

<meta http-equiv="cache-control" content="no-chache" />
<meta name="robots" content="noarchive" />
<meta name="revisit-after" content="7 days" />
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
body {word-wrap: break-word;}
div#main { zoom: 1; paddint-top: 0; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="css/png_fix.css" />
<![endif]-->
</head>
<body>
<div id="container">
<div id="logo"class="png"></div>
<!-- end #logo -->
<div id="menu">
<ul>
<li><a class="selected" href="home.php"><img src="images/home.png" alt="Home" width="206" height="35" title="Home" /></a></li>
<li><a class="selected" href="home.php"><img src="images/home2.png" alt="Home" width="206" height="35" title="Home" /></a></li>
<li><a href="products.php"><img src="images/products.png" alt="Products" width="206" height="35" title="Products"/></a></li>
<li><a href="products.php"><img src="images/products2.png" alt="Products" width="206" height="35" title="Products"/></a></li>
<li><a href="about_water.php"><img src="images/water.png" alt="About Water" width="206" height="35" title="About Water"/></a></li>
<li><a href="about_water.php"><img src="images/water2.png" alt="About Water" width="206" height="35" title="About Water"/></a></li>
<li><a href="warranty.php"><img src="images/warranty.png" alt="Warranty" width="206" height="35" title="Warranty"/></a></li>
<li><a href="warranty.php"><img src="images/warranty2.png" alt="Warranty" width="206" height="35" title="Warranty"/></a></li>
<li><a href="contact_us.php"><img src="images/contact.png" alt="Contact Us" width="206" height="35" title="Contact Us"/></a></li>
<li><a href="contact_us.php"><img src="images/contact2.png" alt="Contact Us" width="206" height="35" title="Contact Us"/></a></li>
</ul>
</div>
<!-- end #menu -->
<div id="main"></div>
<!-- end #main -->
<div class="push"></div>
<div class="footer"></div>
<!-- end #footer -->
</div>
</body>
</html>

4css

12:03 pm on Mar 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
[b]Systems!" />[/b]

I have placed in bold something that I question in your header code. It could be whatever this is, might be throwing off your page a bit.

If you could explain this and why you put this here, or take it out to test and see if this is an issue, then report back and let us know.

4~css!

Jgrnet

1:45 pm on Mar 4, 2008 (gmt 0)

10+ Year Member



That was due to the description tag when I cut a pasted the code. Sorry.

I have fixed all the issues except sticking the footer to the bottom of the bage with no scroll bar. The sticky footer fix creates way too much scrolling then needed. Can this be achieved?

4css

2:10 pm on Mar 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can do a google on footers. There are many tutorials out there on how to place a footer.

Sometimes it can be achieved with negative margins.

I don't see how the footer push accomplishes anything.

All that you have in there is the size of the footer. This does nothing to place the footer if this is what you are trying to accomplish.

It is great to hear that you have fixed the other issues. If you could post what you did to fix them, it could help others who have had the same issues and are searching for an answer to help them out. (just a suggestion) ;)

Jgrnet

1:42 am on Mar 5, 2008 (gmt 0)

10+ Year Member




I have searched all over the web all the sticky footers rely on html body 100% this pushes the footer to the bottom but with needless scrolling. That is the difference here.

Jgrnet

1:42 am on Mar 5, 2008 (gmt 0)

10+ Year Member




I used Dreamweaver CS3 template to guide me here is the code.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
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;
}
.thrColLiqHdr #container {
width: 80%; /* this will create a container 80% of the browser width */
background: #FFFFFF;
margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
border: 1px solid #000000;
text-align: left; /* this overrides the text-align: center on the body element. */
}
.thrColLiqHdr #header {
background: #DDDDDD;
padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
}
.thrColLiqHdr #header h1 {
margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
}

/* Tips for sidebars:
1. Since we are working in percentages, it's best not to use side padding on the sidebars. It will be added to the width for standards compliant browsers creating an unknown actual width.
2. Space between the side of the div and the elements within it can be created by placing a left and right margin on those elements as seen in the ".thrColLiqHdr #sidebar1 p" rule.
3. Since Explorer calculates widths after the parent element is rendered, you may occasionally run into unexplained bugs with percentage-based columns. If you need more predictable results, you may choose to change to pixel sized columns.
*/
.thrColLiqHdr #sidebar1 {
float: left; /* this element must precede in the source order any element you would like it be positioned next to */
width: 22%; /* since this element is floated, a width must be given */
background: #EBEBEB; /* the background color will be displayed for the length of the content in the column, but no further */
padding: 15px 0; /* top and bottom padding create visual space within this div */
}
.thrColLiqHdr #sidebar2 {
float: right; /* this element must precede in the source order any element you would like it be positioned next to */
width: 23%; /* since this element is floated, a width must be given */
background: #EBEBEB; /* the background color will be displayed for the length of the content in the column, but no further */
padding: 15px 0; /* top and bottom padding create visual space within this div */
}
.thrColLiqHdr #sidebar1 p, .thrColLiqHdr #sidebar1 h3, .thrColLiqHdr #sidebar2 p, .thrColLiqHdr #sidebar2 h3 {
margin-left: 10px; /* the left and right margin should be given to every element that will be placed in the side columns */
margin-right: 10px;
}

/* Tips for mainContent:
1. the space between the mainContent and sidebars is created with the left and right margins on the mainContent div.
2. to avoid float drop at a supported minimum 800 x 600 resolution, elements within the mainContent div should be 300px or smaller (this includes images).
3. in the Internet Explorer Conditional Comment below, the zoom property is used to give the mainContent "hasLayout." This avoids several IE-specific bugs.
*/
.thrColLiqHdr #mainContent {
margin: 0 24% 0 23.5%; /* the right and left margins on this div element creates the two outer columns on the sides of the page. No matter how much content the sidebar divs contain, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the sidebar spaces when the content in each sidebar ends. */
}

.thrColLiqHdr #footer {
padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
background:#DDDDDD;
}
.thrColLiqHdr #footer p {
margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
}

/* Miscellaneous classes for reuse */
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page The floated element must precede the element it should be next to on the page. */
float: left;
margin-right: 8px;
}
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain its child floats */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
-->
</style>
<!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.thrColLiqHdr #sidebar2, .thrColLiqHdr #sidebar1 { padding-top: 30px; }
.thrColLiqHdr #mainContent { zoom: 1; padding-top: 15px; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->
<script type="text/javascript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW ¦¦ innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>

<body class="thrColLiqHdr">

<div id="container">
<div id="header">
<h1>Header</h1>
<!-- end #header --></div>
<div id="sidebar1">
<h3>Sidebar1 </h3>
<p>The background color on this div will only show for the length of the content. If you'd like a dividing line instead, place a border on the left side of the #mainContent div if the #mainContent div will always contain more content than the #sidebar1 div. </p>
<p>Donec eu mi sed turpis feugiat feugiat. Integer turpis arcu, pellentesque eget, cursus et, fermentum ut, sapien. </p>
<!-- end #sidebar1 --></div>
<div id="sidebar2">
<h3>Sidebar2 </h3>
<p>The background color on this div will only show for the length of the content. If you'd like a dividing line instead, place a border on the right side of the #mainContent div if the #mainContent div will always contain more content than the #sidebar2 div. </p>
<p>Donec eu mi sed turpis feugiat feugiat. Integer turpis arcu, pellentesque eget, cursus et, fermentum ut, sapien. </p>
<!-- end #sidebar2 --></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. </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>
<!-- end #mainContent --></div>
<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
<div id="footer">
<p>Footer</p>
<!-- end #footer --></div>
<!-- end #container --></div>
</body>
</html>

Jgrnet

1:44 am on Mar 5, 2008 (gmt 0)

10+ Year Member



Just use sidebar for which ever side you want your nav or menu. Main content etc.