Jump to content


Css float & padding


1 reply to this topic

#1 Misapoes

    Young Padawan

  • Members
  • Pip
  • 13 posts

Posted 19 July 2006 - 12:20 PM

Hi,I've just started learning css (I love it btw)
and I coded some of my layouts with it succesfully.
However,in the layout i'm currently coding i wantto have 2 columns, so i used float.

Everything looked right in dreamweaver, but in firefox or IE it looked like wtf?

Anyways, if i use padding it's even more fucked up in IE.

Posted Image

This is what it looks like (there's no padding now)

here's the css code

html, body {
	background:url(images/BG.gif);
	margin: 0;
	padding: 0;
}
body {
	font-family: Arial, Helvetica, Verdana, Sans-serif;
	font-size: 12px;
	color: #666666;
	background: #ffffff;
}
#page-container {
	width: 589px;
	margin: auto;
}
#header {
	background: blue;
	height: 120px;
}
#main-nav {
	background: url(images/navbg.gif);
	height: 26px;
}
#sidebar-a {
	float: right;
	width: 295px;
	background: url(images/contentright.gif);
}
#sidebar-a .padding {
	padding: 17px;
}
#content {
	width: 294px;
	background: url(images/contentleft.gif);
	height:100%;
}
#content .padding {
	padding: 17px;
}
#footer {
	height: 34px;
	clear:both;
}



And here's the Html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title></title>
	<meta http-equiv="Content-Language" content="en-us" />
	
	<meta http-equiv="imagetoolbar" content="no" />
	<meta name="MSSmartTagsPreventParsing" content="true" />
	
	<meta name="description" content="" />
	<meta name="keywords" content="" />
	
	<meta name="author" content="" />
	
	<style type="text/css" media="all">@import "master.css";body {
	background-image: url(images/BG.gif);
}
</style>
</head>

<body>
<div id="page-container">
  <div id="header"><img src="images/header.gif" alt="header" width="589" height="120" /></div>
	
	<div id="main-nav"><img src="images/nav1.gif" alt="nav1" width="110" height="26" /><img src="images/nav2.gif" alt="nav2" width="90" height="26" /><img src="images/nav3.gif" alt="nav3" width="90" height="26" /><img src="images/nav4.gif" alt="nav4" width="90" height="26" /><img src="images/nav5.gif" alt="nav5" width="90" height="26" /><img src="images/nav6.gif" alt="nav6" width="119" height="26" /></div>
	<div id="sidebar-a">
	  <p>hoi	
	  </p>
	  </div>
	<div id="content" >
	  hoi
	</div>
	
	<div id="footer"><img src="images/footer.gif" alt="footer" width="589" height="34" /></div>
</div>
</body>
</html>




If anyone wants the download of it all in a rar
http://www.bestshari...53/css.rar.html




Thanks in advance!

#2 Brammy

    Young Padawan

  • Members
  • Pip
  • 15 posts

Posted 19 July 2006 - 04:04 PM

Try changing this in your CSS

#sidebar-a {
	float: left;
	width: 295px;
	background: url(images/contentright.gif);
}
#sidebar-a .padding {
	padding: 17px;
}
#content {
	width: 294px;
	background: url(images/contentleft.gif);
	height:100%;
	float:left;
}

lemme know if it works out





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users