Help! I can't get my boxes to align!!

This is a discussion on "Help! I can't get my boxes to align!!" within the Starting Out section. This forum, and the thread "Help! I can't get my boxes to align!! are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Starting Out

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jan 29th, 2007, 14:38
Up'n'Coming Member
Join Date: Jan 2007
Location: Canada
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Help! I can't get my boxes to align!!

Hi! I really hope someone can help me... I am trying to get the sidecol to align about 10 or 20 px to the right of the leftcol, and the maincol to align about 20px to the right of the sidecol, all the while not surpassing the 100% width of the Master box. This is a test layout that I would like to use on a site I am about to build. Don't worry about the crappy colors, they are just there to help me see what I am doing... although they don't seem to be helping much lol. Here is the code:

<title>Test layout</title>
<style type="text/css">
<!--
body {
margin: 0px;
padding: 0px;
background-color: #FF0000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
text-align: center;
}
#master {
position: absolute;
width:100%;
margin-left: 0px;
margin-top: 0px;
border: 0px solid black;
background-color: transparent;
text-align: left;
left: 0px;
height: 900px;
}
#logo {
position: absolute;
width:200px;
height:127px;
top: 0px;
left: 0px;
background-color: #6666FF;
z-index: 3}
#leftcol {
position: absolute;
width:200px;
height:100%;
top: 0px;
left: 0px;
background-color: #6006FF;
z-index: 1;
overflow: auto;
float: left;
margin-top: 0px;
margin-right: 5px;
margin-bottom: 0px;
margin-left: 0px;
}
#navbar {
position: relative;
height:35px;
width: 100%;
top: auto;
text-align: right;
background-color: #010080;
line-height: 35px;
margin: auto;
left: 0px;
overflow: hidden;
}
#picture {
position: relative;
height:92px;
width: 100%;
top: 0px;
right: 0px;
background-color: #010080;
z-index: 1;
left: 0;
background-image: url(Images/testpichead1.jpg);
background-repeat: no-repeat;
}
#bodywrap {
background-color: #999999;
left: 0px;
position: absolute;
padding: 0px;
top: auto;
width: 100%;
margin: 0px;
float: left;
overflow: hidden;
}
#sidecol {
width:200px;
background-color: #00FFFF;
margin-bottom: 20px;
padding: 5px;
margin-left: auto;
position: relative;
float: left;
margin-top: 0px;
margin-right: 0px;
left: auto;
top: 0px;
overflow: hidden;
visibility: visible;
}
#maincol {
width: 400px;
background-color: #99FF66;
margin-bottom: 20px;
padding: 5px;
margin-left: 0px;
top: 0px;
border: 0px solid #000000;
position: relative;
margin-top: 0px;
margin-right: 0px;
float: none;
}
#footer {
width:100%;
height:30px;
clear: both;
padding: 10px 0px;
text-align: center;
color: #000000;
background-color: #FFFF99;
line-height: 25px;
}
-->
</style>
<style type="text/css">
#divFoldCont {position:absolute; left:80px; top:100px; width:170px; visibility:hidden;}
.clFold {position:absolute; width:170px;}
.clFoldSub {position:absolute; left:15px; width:170px; visibility:hidden;}
.clFoldSub2 {position:absolute; left:15px; width:170px; visibility:hidden;}
.clFoldLinks {font-family:Arial, Verdana, Helvetica, Helv; font-size:14px; font-weight:bold; text-decoration:none; color:black;}
.clSubLinks {font-family:Arial, Verdana, Helvetica, Helv; font-size:14px; font-weight:bold; text-decoration:none; color:black;}
.clSubLinks2 {font-family:Arial, Verdana, Helvetica, Helv; font-size:12px; text-decoration:none; color:black;}
.style1 {
font-size: 24px;
font-weight: bold;
}
a {
font-family: Arial, Helvetica, sans-serif;
color: #660066;
font-size: 16px;
font-weight: bold;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #660066;
}
a:hover {
text-decoration: underline;
color: #6699FF;
}
a:active {
text-decoration: none;
color: #6699FF;
}
.style2 {color: #FFFFFF}
.style3 {
font-size: 14px;
font-weight: bold;
}
</style>
</head>
<body onload="foldInit()">
<div id="master">
<div id="leftcol">
<p>Left column</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>

<div id="picture">Picture
<div class="style1" id="logo">
<div align="center">
<p>&nbsp;</p>
<p>Logo</p>
</div>
</div>

</div>

<div id="navbar">
<p class="style2">Home | Photo gallery| Contact us </p>
</div>

<div id="bodywrap">

<div id="sidecol" >
<h3>sidebar</h3>
<ul>
<li>List</li>
<li>List</li>
<li>List</li>
</ul>
</div>

<div id="maincol">
<h2>main content</h2>
<p>Blah blah blah blah. </p>
</div>

<div id="footer">
<p class="style3">Footer</p>
</div>

</div>
</div>
</body>
</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jan 29th, 2007, 16:53
Elite Veteran
Join Date: Aug 2005
Location: That Place
Posts: 2,044
Blog Entries: 1
Thanks: 0
Thanked 37 Times in 37 Posts
Re: Help! I can't get my boxes to align!!

Give us a link pls.
__________________

Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jan 29th, 2007, 17:02
Up'n'Coming Member
Join Date: Jan 2007
Location: Canada
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help! I can't get my boxes to align!!

Sorry, I'm not sure what you mean... My site (page) isn't online yet, but I could put it on a temporary location if you need it to be online...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Jan 29th, 2007, 17:10
Up'n'Coming Member
Join Date: Jan 2007
Location: Canada
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Talking Re: Help! I can't get my boxes to align!!

Ok, don't aks me what I did, but it's finally working!!! I have another question though... How do I get my main column to squish like my navbar and footer when I make the window smaller? Thanks again for your help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Jan 29th, 2007, 17:30
Up'n'Coming Member
Join Date: Jan 2007
Location: Canada
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Oops!

I thought I had fixed it, but it looks horrible at 600X800. I just want 2 seperate boxes (side by side) inside the bodywrap and to the left of the left column, and I'd like it to look good in most browsers from 600X800 and up. Can it be done, or am I a victim of wishful thinking? LOL Here is my new code btw:

<!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=iso-8859-1" />
<title>Test layout</title>
<style type="text/css">
<!--
body {
margin: 0px;
padding: 0px;
background-color: #FF0000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
text-align: center;
}
#master {
position: absolute;
width:100%;
margin-left: 0px;
margin-top: 0px;
border: 0px solid black;
background-color: transparent;
text-align: left;
left: 0px;
height: 900px;
}
#logo {
position: absolute;
width:200px;
height:127px;
top: 0px;
left: 0px;
background-color: #6666FF;
z-index: 3}
#leftcol {
position: absolute;
width:200px;
height:100%;
top: 0px;
left: 0px;
background-color: #6006FF;
z-index: 1;
float: left;
margin-top: 0px;
margin-right: 5px;
margin-bottom: 0px;
margin-left: 0px;
}
#navbar {
position: relative;
height:35px;
width: 100%;
top: auto;
text-align: right;
background-color: #010080;
line-height: 35px;
margin: auto;
left: 0px;
overflow: hidden;
}
#picture {
position: relative;
height:92px;
width: 100%;
top: 0px;
right: 0px;
background-color: #010080;
z-index: 1;
left: 0;
background-image: url(Images/testpichead1.jpg);
background-repeat: no-repeat;
}
#bodywrap {
background-color: #999999;
left: 0px;
position: absolute;
padding: 0px;
top: auto;
width: 100%;
margin: 0px;
float: left;
overflow: hidden;
}
#sidecol {
width:200px;
background-color: #00FFFF;
margin-bottom: 20px;
padding: 5px;
margin-left: auto;
position: relative;
float: left;
margin-top: 0px;
margin-right: 0px;
left: 20%;
top: 0px;
overflow: hidden;
visibility: visible;
}
#maincol {
width: 550px;
background-color: #99FF66;
margin-bottom: 20px;
padding: 5px;
margin-left: 0px;
top: 0px;
border: 0px solid #000000;
position: relative;
margin-top: 0px;
margin-right: 0px;
float: right;
left: 0%;
}
#footer {
width:100%;
height:30px;
clear: both;
padding: 10px 0px;
text-align: center;
color: #000000;
background-color: #FFFF99;
line-height: 25px;
}
-->
</style>
<style type="text/css">
#divFoldCont {position:absolute; left:80px; top:100px; width:170px; visibility:hidden;}
.clFold {position:absolute; width:170px;}
.clFoldSub {position:absolute; left:15px; width:170px; visibility:hidden;}
.clFoldSub2 {position:absolute; left:15px; width:170px; visibility:hidden;}
.clFoldLinks {font-family:Arial, Verdana, Helvetica, Helv; font-size:14px; font-weight:bold; text-decoration:none; color:black;}
.clSubLinks {font-family:Arial, Verdana, Helvetica, Helv; font-size:14px; font-weight:bold; text-decoration:none; color:black;}
.clSubLinks2 {font-family:Arial, Verdana, Helvetica, Helv; font-size:12px; text-decoration:none; color:black;}
.style1 {
font-size: 24px;
font-weight: bold;
}
a {
font-family: Arial, Helvetica, sans-serif;
color: #660066;
font-size: 16px;
font-weight: bold;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #660066;
}
a:hover {
text-decoration: underline;
color: #6699FF;
}
a:active {
text-decoration: none;
color: #6699FF;
}
.style2 {color: #FFFFFF}
.style3 {
font-size: 14px;
font-weight: bold;
}
</style>
</head>
<body onload="foldInit()">
<div id="master">
<div id="leftcol">
<p>Left column</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>

<div id="picture">Picture
<div class="style1" id="logo">
<div align="center">
<p>&nbsp;</p>
<p>Logo</p>
</div>
</div>

</div>

<div id="navbar">
<p class="style2">Home | Photo gallery| Contact us </p>
</div>

<div id="bodywrap">

<div id="sidecol" >
<h3>sidebar</h3>
<ul>
<li>List</li>
<li>List</li>
<li>List</li>
</ul>
</div>

<div id="maincol">
<h2>main content</h2>
<p>Blah blah blah blah. </p>
</div>

<div id="footer">
<p class="style3">Footer</p>
</div>

</div>
</div>
</body>
</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Jan 29th, 2007, 19:08
Elite Veteran
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help! I can't get my boxes to align!!

Yes, please put it in a temporary location, it makes it very hard for us to see what is happing without a link. So please upload it somewhere and post a link and we would be glad to help!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Jan 29th, 2007, 20:02
Up'n'Coming Member
Join Date: Jan 2007
Location: Canada
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help! I can't get my boxes to align!!

Ok, here it is:

http://www.personainternet.com/~potier/Tests/Home.html

Thanks again for all your help, it's very appreciated!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Jan 29th, 2007, 20:04
Up'n'Coming Member
Join Date: Jan 2007
Location: Canada
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help! I can't get my boxes to align!!

Looking at it again, if the sidebar and maincontent boxes could contract with the window, it may be all that I need for the page to work?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Jan 29th, 2007, 20:18
Up'n'Coming Member
Join Date: Jan 2007
Location: Canada
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help! I can't get my boxes to align!!

Also, I would like for them NOT to go under the leftmost column when the window is contracted... Sorry for being such a pest... I've just run out of ideas!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Jan 30th, 2007, 02:34
Reputable Member
Join Date: Jul 2006
Location: Scotland
Age: 22
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help! I can't get my boxes to align!!

Is this something like what you were after? (I haven't fully cleaned up your code there's still a lot of scary, un-needed stuff in there!). I wasn't exactly sure what you wanted...:

CSS

Code: Select all
<!--
body {
    margin: 0px;
    padding: 0px;
    background-color: #FF0000;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    text-align: center;
    text-align: left;
    height: 900px;
}


#logo {

    width:200px;
    height:127px;
    float:left;
    background-color: #6666FF;}

#leftcol {
    width:200px;
    background-color: #6006FF;
    float: left;
}

#navbar {
    height:35px;
    text-align: right;
    background-color: #010080;
    line-height: 35px;
    overflow: hidden;
}

#picture {
    height:92px;
    background:pink url(Images/testpichead1.jpg) no-repeat;
}

#bodywrap {
    background-color: #999999;
    overflow: hidden;
}
#sidecol {
    width:200px;
    background-color: #00FFFF;
    margin-bottom: 20px;
    padding: 5px;
    float: left;
    overflow: hidden;
}
#maincol {
    background-color: #99FF66;
    margin-bottom: 30px;
    padding: 5px 5px 5px 5px;
    border: 0px solid #000000;
}
#footer {
    height:30px;
    padding: 10px 0px;
    text-align: center;
    color: #000000;
    background-color: #FFFF99;
    line-height: 25px;
}
html:

Code: Select all
<body onload="foldInit()">


<div class="style1" id="logo">
<p>Logo</p>
</div>

  <div id="picture">Picture
  </div>

  <div id="navbar">
      <p class="style2">Home | Photo gallery| Contact us  </p>
  </div>

  <div id="leftcol">
    <p>Left column</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
  </div>

  </div>



  <div id="bodywrap">

    <div id="sidecol" >
      <h3>sidebar</h3>
      <ul>
        <li>List</li>
        <li>List</li>
        <li>List</li>
      </ul>
    </div>

    <div id="maincol">
      <h2>main content</h2>
      <p>Blah blah blah blah. </p>
    </div>

    <div id="footer">
      <p class="style3">Footer</p>
    </div>

  </div>
</body>

Hope it's something close!
All the best,
Snow
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Jan 30th, 2007, 10:54
Up'n'Coming Member
Join Date: Jan 2007
Location: Canada
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help! I can't get my boxes to align!!

Has anyone ever told you Snow that you are a GENIUS!!! The only thing I have to fix is that in ie the reader is a few px too far to the left, but otherwise, it's PERFECT at both resolutions in all 3 browsers I checked it in (ie, ns, ff)(am I missing any major popular browsers that I should add to the mix?). All I have to say is THANK YOU THANK YOU THANK YOU!!! Now I have to go and study your code to see how you did it And see what I can clean up
Lilly
xxx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Jan 30th, 2007, 13:37
Up'n'Coming Member
Join Date: Jan 2007
Location: Canada
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help! I can't get my boxes to align!!

Ok, I've played around with it, and I can't seem to get rid of the unwanted space between the logo and the Header+Navbar in IE... I'll show you what I see:



Any help would be greatly appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old Jan 30th, 2007, 13:39
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help! I can't get my boxes to align!!

you like green much?

What version of IE is that? I don't see that gap in IE6 on Win2000.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old Jan 30th, 2007, 13:55
Up'n'Coming Member
Join Date: Jan 2007
Location: Canada
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help! I can't get my boxes to align!!

I was in a green mood yesterday, and it goes with my new wallpaper

I am using version 6.0.2800.1106. My resolution is an 1024 X 768, but it does the same thing at 800 X 600.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15  
Old Jan 30th, 2007, 14:06
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help! I can't get my boxes to align!!

Here's what I get in FF and IE6

FF.jpg IE.jpg
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #16  
Old Jan 30th, 2007, 16:13
Up'n'Coming Member
Join Date: Jan 2007
Location: Canada
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help! I can't get my boxes to align!!

Strange... Well, I suppose if the rest of the word can see it properly, that's all that matters Although I'm such a perfectionist, I think I'll still try to play around with it!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #17  
Old Jan 30th, 2007, 16:53
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help! I can't get my boxes to align!!

Quote:
Originally Posted by Moonlilly View Post
Strange... Well, I suppose if the rest of the word can see it properly, that's all that matters
I hope you were joking with that?