Results 1 to 6 of 6

Thread: CSS Layout and Positioning question

  1. #1
    Senior Member Kata's Avatar
    Join Date
    Sep 2008
    Location
    Den Haag
    Posts
    641
    Thanks
    27
    Thanked
    134 times in 61 posts
    • Kata's system
      • Motherboard:
      • Asus Rampage Formula
      • CPU:
      • Q9650
      • Memory:
      • 8GB Corsair Dominator DDR2
      • Storage:
      • RaptorX + 2.0TB NAS Raid5
      • Graphics card(s):
      • 2 x Sapphire Radeon 4870 1GB
      • PSU:
      • Tagan 900W
      • Case:
      • Thermaltake Armor LCS
      • Operating System:
      • Vista 64
      • Monitor(s):
      • 3 x Dell 2408WXP

    CSS Layout and Positioning question

    Hi all,

    I have a PSD, currently under discussion in another thread, about how I wish my website to look. I am trying to set up a CSS template in the same shape, and am using relative positioning.

    Here is the picture of how I want the layout: (final will have 3 boxes across the middle, not 2).

    Desired Layout

    And here is my current effort:

    Current layout

    The problem is, because of relative positioning, the page ends up about twice as long as it should be, with a whole screen of blank space at the bottom! Is there a better way I could do this? I have tried to have a go with 'float' but the boxes shoot off in weird directions.

  2. #2
    HEXUS webmaster Steve's Avatar
    Join Date
    Nov 2003
    Posts
    14,283
    Thanks
    293
    Thanked
    841 times in 476 posts

    Re: CSS Layout and Positioning question

    I think you'd be much better off using floating elements and margins and CSS background images where necessary. Should be nice and easy seeing as it's fixed width.

    Alternatively use absolute positioning - trick here is to make the parent element position: relative, then any absolutely positioned children are done so within the confines of the parent. I think you have to make sure everything has a width/height defined though else you run into IE6 "hasLayout" issues - if you care, of course
    PHP Code:
    $s = new signature();
    $s->sarcasm()->intellect()->font('Courier New')->display(); 

  3. #3
    Not a good person scaryjim's Avatar
    Join Date
    Jan 2009
    Location
    Gateshead
    Posts
    15,196
    Thanks
    1,231
    Thanked
    2,291 times in 1,874 posts
    • scaryjim's system
      • Motherboard:
      • Dell Inspiron
      • CPU:
      • Core i5 8250U
      • Memory:
      • 2x 4GB DDR4 2666
      • Storage:
      • 128GB M.2 SSD + 1TB HDD
      • Graphics card(s):
      • Radeon R5 230
      • PSU:
      • Battery/Dell brick
      • Case:
      • Dell Inspiron 5570
      • Operating System:
      • Windows 10
      • Monitor(s):
      • 15" 1080p laptop panel

    Re: CSS Layout and Positioning question

    Personally I'd go for the Absolute positioning for all the "layout" elements with appropriate margins on the "content" element - so your menu, splash image and text boxes would all be position: absolute; and then you'd have a <div id="main"> with the top-margin set to ensure the content started below the splash image and menus.

    Frankly, relative positioning is a PITA and far less controllable than absolute, if what you're looking for is control over the appearance then absolute is your friend. Alternatively, if you want any elements to maintain their position in the window while the content scrolls under or over them, you can use position: fixed; - very useful for setting up "frames" type pages without messing around with frames.
    Last edited by scaryjim; 26-02-2010 at 12:09 AM.

  4. #4
    Senior Member Kata's Avatar
    Join Date
    Sep 2008
    Location
    Den Haag
    Posts
    641
    Thanks
    27
    Thanked
    134 times in 61 posts
    • Kata's system
      • Motherboard:
      • Asus Rampage Formula
      • CPU:
      • Q9650
      • Memory:
      • 8GB Corsair Dominator DDR2
      • Storage:
      • RaptorX + 2.0TB NAS Raid5
      • Graphics card(s):
      • 2 x Sapphire Radeon 4870 1GB
      • PSU:
      • Tagan 900W
      • Case:
      • Thermaltake Armor LCS
      • Operating System:
      • Vista 64
      • Monitor(s):
      • 3 x Dell 2408WXP

    Re: CSS Layout and Positioning question

    Well, the second try is looking a lot better so far - thanks for the tips!

    My next puzzle is setting up a decent CSS dropdown menu...

  5. #5
    HEXUS webmaster Steve's Avatar
    Join Date
    Nov 2003
    Posts
    14,283
    Thanks
    293
    Thanked
    841 times in 476 posts

    Re: CSS Layout and Positioning question

    Oh there's loads of ways of doing that, again absolute positioning within the relatively positioned top bar is the way I tend to use - have a google there are various ways.

    Of course, for IE6 compatibility, you'll have to rely on a:hover as it doesn't work on any other element, otherwise you have to crack out the javascript.
    PHP Code:
    $s = new signature();
    $s->sarcasm()->intellect()->font('Courier New')->display(); 

  6. #6
    Registered+
    Join Date
    Nov 2007
    Posts
    22
    Thanks
    0
    Thanked
    1 time in 1 post

    Re: CSS Layout and Positioning question

    For CSS menus you could have a look at cssplay.co.uk (specifically cssplay.co.uk/menus/final_drop.html) - I found it a good starting point for a pure CSS menu.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 8
    Last Post: 19-01-2008, 05:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •