10 September, 2007

This post is in: CSS, Web design

CSS ‘sliding doors’: positioning the tabs

A lot has been written on styling html lists to make them look pretty, a good example being Douglas Bowman’s ‘Sliding Doors‘ articles on alistapart.com.

However, I’ve still not managed to master it. Either I have problems with floated elements or IE doesn’t style the tabs properly (IE6, at any rate).

I finally got it to work across browsers the other day, and promptly deleted the files (by accident). I shall try to recreate it and post the results here. In the meantime, here’s what I (think) I did.

Float issues

Block elements that should have come below the tabs were sitting to the right of them instead.

I think this was solved by setting an element to display:block – and I think that element was a – but I’ll post more when I’ve tried again.

IE style issues

IE6 was losing the top border off the tabs, and apparently adding a bottom margin.

It seems that relative positioning was the answer here. While the list’s containing div was absolutely positioned, IE stubbornly refused to play ball; as soon as I positioned it relatively, IE stopped sulking.

  1. Created div#header with its height in pixels (in which I would put such things as blog title and the navigation tabs) and set this to position:relative;
  2. Set the list’s containing div to position:relative, and set top to force it into its preferred position;
  3. Everything else in div#header was positioned absolutely, so as not to interfere with the flow of the document.

CSS,Web design

  • Posted by Michael @ 7:29 pm
  • Categories: CSS,Web design
  • Tags: ,
  • http://citizensheep.com/blog/2007/09/10/css-sliding-doors-positioning-the-tabs/trackback/

Leave a Reply