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.
|
|
|
|
|
![]() |
||
Help! I can't get my boxes to align!!
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
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> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </div> <div id="picture">Picture <div class="style1" id="logo"> <div align="center"> <p> </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> |
|
|
|
#2
|
|||
|
|||
|
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)
|
|
#3
|
|||
|
|||
|
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...
|
|
#4
|
|||
|
|||
|
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
|
|
#5
|
|||
|
|||
|
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> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </div> <div id="picture">Picture <div class="style1" id="logo"> <div align="center"> <p> </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> |
|
#6
|
|||
|
|||
|
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!!
|
|
#7
|
|||
|
|||
|
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! |
|
#8
|
|||
|
|||
|
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?
|
|
#9
|
|||
|
|||
|
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!
|
|
#10
|
|||
|
|||
|
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
Hope it's something close! All the best, Snow |
|
#11
|
|||
|
|||
|
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
Lilly xxx |
|
#12
|
|||
|
|||
|
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. |
|
#13
|
|||
|
|||
|
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. |
|
#14
|
|||
|
|||
|
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. |
|
#15
|
|||
|
|||
|
Re: Help! I can't get my boxes to align!!
|
|
#16
|
|||
|
|||
|
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
|
|
#17
|
|||
|
|||
|
Re: Help! I can't get my boxes to align!!
Quote:
|