Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

new help needed css layout

Featured Replies

I couldnt get it working propely after my last thread, so i decided to switch from a liquid layout to a set layout. However my formatting is even more messed up, im really going crazy here because i cant fix this.

 

css

 

body {
margin-left: 150px;
margin-right: 150px;

 padding: 0px;
 text-align: center;
 background: #ffffff;
}



#header {

 background-image: url(logo.jpg);
 repeat: no-repeat;
 width:  850px;
 height: 100px;

}


#leftcol {
 background: #FFF;/*e2f5e1*/
 float: left;
 width: 150px;
 height: 500px;
 border-top: 1px solid #97ae95;
 /*border-bottom: 2px solid #97ae95;*/
}


#leftcol a, ul {
  list-style-image: url(i3.gif);
 text-align: left;
 text-decoration: none;
 line-height: 20px;
 font-size: 1em;
 font-family: 'franklin gothic medium';
 color: #14400e;

}

#lcTitle{
 color: #729f70;
 font-family: 'lucida sans';
 font-weight: bold;


}



#rightcol {
 background: #fff;
 float: right;
 width: 200px;
 height: 500px;
 border-top: 1px solid #97ae95;
 border-bottom: 0px solid #97ae95;
}


#content {
 background: #fff;

 width: 500px;
 height: 400px;
 border: 1px solid #97ae95;
 border-left: none;
 border-right: none;




}

#conBoxTitle{

  font-family: 'franklin gothic medium';
  font-weight: bold;
  font-size: 0.9em;
  margin-left: 10px;
  margin-top: 10px;
  color: #8a2733;
}

#conBoxCost{
  font-family: 'franklin gothic medium';
  font-weight: bold;
  font-size: 0.9em;
  color: #526988;
 margin-left: 10px;

}




#conBox1{

 margin: 10px;
 background-image: url(bg.jpg);
 repeat: no-repeat;


  height =211px;
  width = 250px;
  float: left;



}

#conBox2{

  margin: 10px;
  background-image: url(bg.jpg);
repeat: no-repeat;


  height =211px;
  width = 300px;
  float: left;


}

#conBox3{

  margin: 10px;
  background-image: url(bg.jpg);
  repeat: no-repeat;


  height =211px;
  width = 250px;
  float:left;


}



#conBox1 a {

  font-family: 'franklin gothic medium';
  font-weight: bold;
  font-size: 0.9em;
  color: #526988;

}

#conBox2 a {

  font-family: 'franklin gothic medium';
  font-weight: bold;
  font-size: 0.9em;
  color: #526988;

}

#conBox3 a {

  font-family: 'franklin gothic medium';
  font-weight: bold;
  font-size: 0.9em;
  color: #526988;

}

#ImG{
 margin 10px;
 height = 100px;
 width =  100px;
 border: 1px solid #596575;
 margin-left: 30px;
 margin-top: 10px;
}




#adbox1{

  margin: 10px;
  background:#D4DDFF;
  color: #ffffff;
  font-family:'franklin gothic medium';
}

#adbox2{

  margin: 10px;
  background:#D4DDFF;
  color: white;
  font-family:'franklin gothic medium';
}

#adbox3{

  margin: 10px;
  background:#D4DDFF;
  color: #ffffff;
  font-family:'franklin gothic medium';
}



#content2{

 background: #ffffff; /*#e7faf4;*/

 width:500px;
 height: 250px;
 /*border: 1px solid #97ae95;*/
 border-top: none;
 border-bottom: none;


}

#nNews{


}

.con2OutterBox{
  height: 200px;
  width:  250px;
  padding-bottom: 10px;
  padding-left: 30px;
  padding-right: 15px;
  float: left;
}

#Con2Img,#Con2Img2,#Con2Img3{
  padding-top: 2px;
  height = 60px;
  width =  56px;
  border: 1px solid #c9d3cd;
 float: left;

}

#nTextLink a, #nTextLink2 a, #nTextLink3 a{
  padding-left: 5px;
  float: left;
  color: #819b8b;
  font-size: 0.7em
}




}

.con2Header, .con2Header2, .con2Header3 {
  padding-left:10px;
  font-weight:bold;
  font-family: 'franklin gothic medium';
  font-size: 0.8em;
  text-align:left;

}

.con2InnerBox a ,.con2InnerBox2 a,.con2InnerBox3 a {


} 

.con2Header{
  height: 20px;
  background-image: url(con2header2.gif);
  repeat: repeat-x;

}
.con2InnerBox{
  height: 180px;
  width:  250px;


}

.con2OutterBox2{
  margin 10px;
  height: 200px;
  width:  250px;
  padding-bottom: 10px;
  padding-left: 10px;
  padding-right: 15px;
  float: left;
}

.con2Header2{
  height: 20px;
  background-image: url(con2header2.gif);
  repeat: repeat-x;
}
.con2InnerBox2{
  height: 180px;
  width:  250px;


}

.con2OutterBox3{
  height: 200px;
  width:  250px;
  padding-bottom: 10px;
  padding-left: 10px;
  padding-right: 15px;
  float: left;
}

.con2Header3{
  height: 20px;
  background-image: url(con2header2.gif);
  repeat: repeat-x;
}
.con2InnerBox3{
  height: 180px;
  width:  250px;


}

#footer{
 background: #678c66;
 clear: both;
 width: 850px;
 height: 100px

}

#footerText{
 color: #d4f0d3;
 font-family: 'lucida sans';
 font-weight: bold;
 text-align: center;

}

#footerLinks a:link {
 color: #d4f0d3;
 font-family: 'franklin gothic medium';
 font-size: 0.9em;
}

#footerLinks a:hover {
 color: #fbbb76;
 font-family: 'franklin gothic medium';
 font-size: 0.9em;

}

#footerLinks a:visited {
 color: #ffffff;
 font-family: 'franklin gothic medium';
 font-size: 0.9em;

}

 

 

 

html

 

<!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>
<link rel="stylesheet" type="text/css" href="niftyCorners.css">
<link rel="stylesheet" type="text/css" href="niftyPrint.css" media="print">
<link rel="stylesheet" href="float2.css" type="text/css">
<script type="text/javascript" src="nifty.js"></script>
<script type="text/javascript">

window.onload=function(){
if(!NiftyCheck())
return;
Rounded("div#adbox1","all","#FFF","#D4DDFF","smooth");
Rounded("div#adbox2","all","#FFF","#D4DDFF","smooth");
Rounded("div#adbox3","all","#FFF","#D4DDFF","smooth");


}
</script>
</head>
<body>

<div id="header"></div>
<div id="leftcol">
<br>
<div id="lcTitle"> Headings</div>
<div id="lcLinks">
<ul>
 <li > <a href="firstp.html"> First</a></li>
 <li > <a href="firstp.html"> Second</a></li>
 <li > <a href="firstp.html"> Third</a></li>
 <li > <a href="firstp.html"> Fourth</a></li>
 <li > <a href="firstp.html"> Fifth</a></li>
 <li > <a href="firstp.html"> Sixth</a></li>
 <li > <a href="firstp.html"> Seventh</a></li>	
	 <li > <a href="firstp.html"> Eighth</a></li>
</ul>

</div>



</div>
<div id="rightcol">

<div id="adbox1"><p>Welcome, This is my website. This section will hold information about various things</p>
			<p>I'll fill this with relevent stuff later, at the moment this is just to fomat text.</p>
			</div>

<div id="adbox2"><p>Welcome, This is my website. This section will hold information about various things</p>
			<p>I'll fill this with relevent stuff later, at the moment this is just to fomat text.</p>	</div>

<div id="adbox3"><p>Welcome, This is my website. This section will hold information about various things</p>
			<p>I'll fill this with relevent stuff later, at the moment this is just to fomat text.</p>	</div>

</div>


<div id="content">

<div id ="nDeals"><img src="nDeals.gif"/></div>


<div id = "conBox1">
<div id="conBoxTitle">Nvidia GeForce 8600GTS</div>
			  <div id="ImG"><img src ="image1.jpeg" alt="random pic" /></div>
<div id="conBoxCost">Price: <a href="newPage.html">£115.98</a></div>
</div>

			  <div id = "conBox2">
<div id="conBoxTitle">Nvidia GeForce 8600GTS</div>
			  <div id="ImG"><img src ="image1.jpeg" alt="random pic"/></div>
<div id="conBoxCost">Price: <a href="newPage.html">£115.98</a></div>
</div>

			  <div id = "conBox3">
<div id="conBoxTitle">Nvidia GeForce 8600GTS</div>
			  <div id="ImG"><img src ="image1.jpeg" alt="random pic" /></div>
<div id="conBoxCost">Price: <a href="newPage.html">£115.98</a></div>
</div>


</div>





<div id="content2">
<div id="nNews"><img src="nNews.gif"/></div>

<div class ="con2OutterBox">

<div class="con2Header">Entertainment</div>
<div class="con2InnerBox">
<div id="Con2Img"><img src="entLogo.jpg"/img></div>
			  <div id="nTextLink">
	<a href="new.html">Big Brother News</a><br/>
	<a href="new.html">Television News</a><br/>
	<a href="new.html">Celebs in Rehab News</a><br/>
</div>





  </div>


</div>

<div class ="con2OutterBox2">

<div class="con2Header2">Sport</div>
<div class="con2InnerBox2">


<div id="Con2Img2"><img src="sportpic.jpg"/img></div>
			  <div id="nTextLink2">
	<a href="new.html">Churchill Cup</a><br/>
	<a href="new.html">Euro 2008</a><br/>
	<a href="new.html">Ronaldo On the Move ?</a><br/>
</div>


</div>


</div>

<div class ="con2OutterBox3">

<div class="con2Header3">Computers</div>
<div class="con2InnerBox3">


<div id="Con2Img3"><img src="entLogo.jpg"/img></div>
			  <div id="nTextLink3">
	<a href="new.html">Big Brother News</a><br/>
	<a href="new.html">Television News</a><br/>
	<a href="new.html">Celebs in Rehab News</a><br/>
</div>


</div>


</div>

</div>
<div id="footer">

<div id="footerLinks">
<a href="page1.html">Home</a> :: 
<a href="page2.html">Articles</a> :: 
<a href="page3.html">About</a> :: 
<a href="page4.html">More</a> 
</div>
<div id="footerText"><br> Copywrite 2008 - Robe Technology</div>

</div>




</body>
</html>

 

 

I get big gaps appearing everywhere, and its not consistant or anything im a noob, so if someone could help me this would be great. Also in the last thread i noted the point about needing to change from id to class, but to be honest ive done too much and its too later to do that now, im really just looking for a quick fix on this.

Hi

 

Made a few changes to your css, try it and let me know

 

body {
margin:0 auto; 

 padding: 0px;
 text-align: center;
 background: #ffffff;
}



#header {

 background-image: url(logo.jpg);
 background-repeat:no-repeat;
 width:  850px;
 height: 100px;

}


#leftcol {
 background: #FFF;/*e2f5e1*/
 float: left;
 width: 150px;
 height: 500px;
 border-top: 1px solid #97ae95;
 /*border-bottom: 2px solid #97ae95;*/
}


#leftcol a, ul {
  list-style-image: url(i3.gif);
 text-align: left;
 text-decoration: none;
 line-height: 20px;
 font-size: 1em;
 font-family: 'franklin gothic medium';
 color: #14400e;

}

#lcTitle{
 color: #729f70;
 font-family: 'lucida sans';
 font-weight: bold;


}



#rightcol {
 background: #fff;
 float: right;
 width: 200px;
 height: 500px;
 border-top: 1px solid #97ae95;
 border-bottom: 0px solid #97ae95;
}


#content {
 background: #fff;

 width: 500px;
 height: 400px;
 border: 1px solid #97ae95;
 border-left: none;
 border-right: none;




}

#conBoxTitle{

  font-family: 'franklin gothic medium';
  font-weight: bold;
  font-size: 0.9em;
  margin-left: 10px;
  margin-top: 10px;
  color: #8a2733;
}

#conBoxCost{
  font-family: 'franklin gothic medium';
  font-weight: bold;
  font-size: 0.9em;
  color: #526988;
 margin-left: 10px;

}




#conBox1{

 margin: 10px;
 background-image: url(bg.jpg);
 background-repeat:no-repeat;


  height :211px;
  width : 250px;
  float: left;



}

#conBox2{

  margin: 10px;
  background-image: url(bg.jpg);
  background-repeat:no-repeat;


  height :211px;
  width : 300px;
  float: left;


}

#conBox3{

  margin: 10px;
  background-image: url(bg.jpg);
  background-repeat:no-repeat;


  height :211px;
  width : 250px;
  float:left;


}



#conBox1 a {

  font-family: 'franklin gothic medium';
  font-weight: bold;
  font-size: 0.9em;
  color: #526988;

}

#conBox2 a {

  font-family: 'franklin gothic medium';
  font-weight: bold;
  font-size: 0.9em;
  color: #526988;

}

#conBox3 a {

  font-family: 'franklin gothic medium';
  font-weight: bold;
  font-size: 0.9em;
  color: #526988;

}

#ImG{
 margin: 10px;
 height: 100px;
 width :  100px;
 border: 1px solid #596575;
 margin-left: 30px;
 margin-top: 10px;
}




#adbox1{

  margin: 10px;
  background:#D4DDFF;
  color: #ffffff;
  font-family:'franklin gothic medium';
}

#adbox2{

  margin: 10px;
  background:#D4DDFF;
  color: white;
  font-family:'franklin gothic medium';
}

#adbox3{

  margin: 10px;
  background:#D4DDFF;
  color: #ffffff;
  font-family:'franklin gothic medium';
}



#content2{

 background: #ffffff; /*#e7faf4;*/

 width:500px;
 height: 250px;
 /*border: 1px solid #97ae95;*/
 border-top: none;
 border-bottom: none;


}

#nNews{


}

.con2OutterBox{
  height: 200px;
  width:  250px;
  padding-bottom: 10px;
  padding-left: 30px;
  padding-right: 15px;
  float: left;
}

#Con2Img,#Con2Img2,#Con2Img3{
  padding-top: 2px;
  height : 60px;
  width :  56px;
  border: 1px solid #c9d3cd;
 float: left;

}

#nTextLink a, #nTextLink2 a, #nTextLink3 a{
  padding-left: 5px;
  float: left;
  color: #819b8b;
  font-size: 0.7em
}




}

.con2Header, .con2Header2, .con2Header3 {
  padding-left:10px;
  font-weight:bold;
  font-family: 'franklin gothic medium';
  font-size: 0.8em;
  text-align:left;

}

.con2InnerBox a ,.con2InnerBox2 a,.con2InnerBox3 a {


}

.con2Header{
  height: 20px;
  background-image: url(con2header2.gif);
  background-repeat:repeat-x;

}
.con2InnerBox{
  height: 180px;
  width:  250px;


}

.con2OutterBox2{
  margin 10px;
  height: 200px;
  width:  250px;
  padding-bottom: 10px;
  padding-left: 10px;
  padding-right: 15px;
  float: left;
}

.con2Header2{
  height: 20px;
  background-image: url(con2header2.gif);
  background-repeat:repeat-x;

}
.con2InnerBox2{
  height: 180px;
  width:  250px;


}

.con2OutterBox3{
  height: 200px;
  width:  250px;
  padding-bottom: 10px;
  padding-left: 10px;
  padding-right: 15px;
  float: left;
}

.con2Header3{
  height: 20px;
  background-image: url(con2header2.gif);
  background-repeat:repeat-x;
}
.con2InnerBox3{
  height: 180px;
  width:  250px;


}

#footer{
 background: #678c66;
 clear: both;
 width: 850px;
 height: 100px

}

#footerText{
 color: #d4f0d3;
 font-family: 'lucida sans';
 font-weight: bold;
 text-align: center;

}

#footerLinks a:link {
 color: #d4f0d3;
 font-family: 'franklin gothic medium';
 font-size: 0.9em;
}

#footerLinks a:hover {
 color: #fbbb76;
 font-family: 'franklin gothic medium';
 font-size: 0.9em;

}

#footerLinks a:visited {
 color: #ffffff;
 font-family: 'franklin gothic medium';
 font-size: 0.9em;

}

 

Pat

It appears that your #conbox divs are too wide to fit alongside each other inside the #content div.

The #content div has a width of 500px, therefore to get 2 #conbox divs next to each other, they need to be 250px wide each.

If they don't fit next to each other, the browser will stack them underneath instead which is what appears to be happening.

  • Author

Yea i sort of got it working now, everything fits on both mozilla and i.e apart from the header, which responds different to the command margin-left: 12%; different in i.e than in mozilla.

 

Thats not really important though. The thing im noticing now, is that with a liquid design it trys to fit everything onto screen. Is there a command you can add so that when you make the browser window smaller, the items stay the same size and a horizontal scroll bar appears.

 

i just dont want everything to distort. BTW this part of the question is for a new build im going to do, so ill be starting from scratch, so you dont have to add it to the code ive already posted. Thanks.

Yea i sort of got it working now, everything fits on both mozilla and i.e apart from the header, which responds different to the command margin-left: 12%; different in i.e than in mozilla.

 

Thats not really important though. The thing im noticing now, is that with a liquid design it trys to fit everything onto screen. Is there a command you can add so that when you make the browser window smaller, the items stay the same size and a horizontal scroll bar appears.

 

i just dont want everything to distort. BTW this part of the question is for a new build im going to do, so ill be starting from scratch, so you dont have to add it to the code ive already posted. Thanks.

 

Try putting everything in a wrapper div in your html add this

 

 

<div id="wrapper">
<div id="header"></div>
<div id="leftcol">

 

In your css add this

 

#wrapper {
margin:0 auto;
width:860px;
height:auto;
}

 

And then close the wrapper div here

 

<div id="footerText"><br> Copywrite 2008 - Robe Technology</div>

</div></div>

 

Pat

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.