473,664 Members | 3,035 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CSS positioning problem

4 New Member
Hi all,

The height of my page needs to be flexible as the page contains columns with lists which can vary in length. I also have a footer which needs to be stuck to the bottom.

I managed to do all of the above. My problem now is the positioning of the columns. With relative positioning, the columns appear staggered with column2 starting lower than column1.

If I use {float:left}, the two columns stay next to each other which is good but then the footer brings itself up and overlaps with the columns... I don't know if I am clear with my explanation so here is my code. Thanks in advance!


HTML:[html]
<html>
<body>
<div id="container-page">
<div id="container-content">
<div id="container-columns">
<div id="col1">
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
</div>
<div id="col2">
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
</div>
</div >
</div >
<div id="container-foot">footer</div >
</div>
</body>
</html>
[/html]
Expand|Select|Wrap|Line Numbers
  1. <style type="text/css">
  2. <!--
  3. #container-page {
  4. left:50%; 
  5. margin-left:-381px; 
  6. width: 762px; 
  7. position: relative; 
  8. top:0px; 
  9. min-height: 100%; 
  10. height: auto; 
  11. height: 100%;
  12. }
  13.  
  14. #container-content {
  15. padding-bottom: 20px;
  16. }
  17.  
  18. #container-foot { 
  19. width: 760px; 
  20. height: 20px; 
  21. position: absolute; 
  22. bottom: 0;
  23. bottom: -1px;
  24. }
  25.  
  26. #container-columns { 
  27. width:760px; 
  28. top: 0px; 
  29. position:relative; 
  30. display:block;
  31. }
  32.  
  33. #col1 { 
  34. position: relative; 
  35. top: 0px; 
  36. left: 1px; 
  37. width: 234px; 
  38. padding-bottom:40px; 
  39. background-color:#cccccc;
  40. }
  41.  
  42. #col2 { 
  43. position: relative; 
  44. top: 0px; 
  45. left: 262px; 
  46. width: 234px; 
  47. padding-bottom:40px; 
  48. background-color:#cc0000; 
  49. }
  50. -->
  51. </style>
Feb 16 '08 #1
6 1505
just a feeling
87 New Member
Hi sooshi,

use float:left and remove the position:absolu te style from #container-foot. Kindly, early and often test ur pages through
HTML validator
CSS validator

Good Luck.
Feb 16 '08 #2
drhowarddrfine
7,435 Recognized Expert Expert
And use a proper doctype.
Feb 16 '08 #3
sooshi
4 New Member
It works! Thanks guys!
Feb 16 '08 #4
sooshi
4 New Member
I have another urgent question concerning the same layout.

(http://cie7273.com/test/test.html)

The column with lists is not correctly aligned horizontally under IE 7. It should be aligned left with the rest of the layout. Instead, it appears a few pixels to the right.

Can anyone tell me what I'm doing wrong?

Thanks in advance
Feb 18 '08 #5
drhowarddrfine
7,435 Recognized Expert Expert
An 'id' is a unique name assigned to only one element on a page. Validate your html for that list of errors, then validate your css for the error there.

If those don't work, add margin:0 and padding:0 to the lists and/or containers.

What's with all the divs around the list?
Feb 18 '08 #6
sooshi
4 New Member
Thanks for that. Unfortunately, it doesn't seem to do the trick.
Feb 19 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

12
2334
by: Tom Szabo | last post by:
Hi, Just wondering if there are any disadvantage in absolute positioning controls on a page? In example instead of putting the text fields into a table to align properly, one would absolute position them. I understand the issue with resize, that is not a problem.
9
32048
by: Bryan R. Meyer | last post by:
Hello Everyone, The problem of browser resizing has become an issue for me. While redesigning my webpage, I set the left and right margins to be auto so that my content would be centered. However, there are images that I used absolute positioning in order to place them in the appropriate location on my page. When I do a browser resize, these images do not move (obviously). However, the rest of my content is auto centered as...
4
2705
by: Jane Withnolastname | last post by:
I am trying to re-work an old site by replacing the html with css. On the main page, I have a logo image which I needed centred on the initial screen. I found the solution here: http://www.wpdfd.com/editorial/wpd0103.htm#toptip (the second example) The problem is, under the image is a large table. But using the above positioning, now the table starts at the top of the page and runs underneath the image.
14
2469
by: Harlan Messinger | last post by:
What am I not understanding about the definition of { position: absolute; }? "The box's position (and possibly size) is specified with the 'left', 'right', 'top', and 'bottom' properties. These properties specify offsets with respect to the box's containing block." Please take a look at http://gavelcade.com/abspos.html and help me understand why my nested, absolutely positioned divs are being positioned with respect to the page rather...
6
2677
by: rajek | last post by:
I posted a similar question yesterday, but didn't get an answer that resolved the issue. (Thanks to those who tried though.) The background: I've read in books and online that if you have one element with "relative" positioning, such as a <div>, it creates a "positioning context" for element within it. E.g., if you have a <p> inside your <div> you can give it absolute positioning and position it (right, left, top, bottom) in terms of the...
9
1802
by: Frances Del Rio | last post by:
I have a pg with lots of divs, one of them is a gray bar about 150px down from the top and 20px from the left... this bar (an image) is 767px wide and 1px high.. however, even though all divs are positioned consistently in IE and Netscape, in Netscape (7.1) the bar div ONLY is about 10px ABOVE where it should be.. code: HTML: <div id="bar"> <img src="images/bar.gif" width="768" height="1" border="0"> </div>
11
2629
by: NS | last post by:
I am relativly new to css positioning and have a question regarding the display of a DHTML pop-up Here is the basic HTML I am using: <html> <head> <script language="JavaScript"> <!--
4
7811
by: TheCeej | last post by:
I'm sorry to post what is ultimately a myspace problem, but I'm sure I'd still be having this problem with any html/css document, so the answer would more than likely be able to help anyone out. I'm pretty sure I know what the problem is already. I just don't know how to fix it. I'd be very grateful of any help. I'll post what I'm trying to do, what keeps happening, what I believe the problem is, the link to my page and the css, and things...
2
16407
by: nino9stars | last post by:
Hello, I have just started messing with absolute positioning on webpages, and it definitely let's you do some creative things. Well, after much searching and help, I got the images I was using to overlap correctly. You can see it on this page: www.creativekaysjewelry.com The images overlap exactly how I wanted and in the right position
2
1927
by: TheCruelPanda | last post by:
Hey there. My name is Rowan, and it's been three weeks since I last used tables for an HTML design. Okay, I'm rather new to CSS and I have a big positioning problem here. It might not be a really huge problem, but I've been fighting it for days, and have received no help so far. Have a look at this (try it out in IE and Firefox please) http://www.discoverourmusic.com/rowan/css/home.html - The problem's with the fairy at the top. On...
0
8437
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8348
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8861
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8778
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4185
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.