Jump to content

Recommended Posts

Is there a way to put the list based menu AFTER your main content (even though it shows up at the top of the screen?)

 

A little sample in case it's not clear:


<ul>
<li>menu 1</li>
<li>menu 2</li>
<li>menu 3</li>
</ul>

<h1>Want this above the CSS list</h1>

 

I want the main content to be above, for accessibilty and SEO reasons.

 

But I still want the drop down menu to show on top of the screen. Is this possible?

 

Thank you.

 

Link to comment
https://forums.phpfreaks.com/topic/52857-move-a-css-based-menu-to-the-bottom/
Share on other sites

Depends how you want your site to look and how you want the menu to be positioned.

 

You could quite easily put the menu in a div and use the CSS positioning attributes to specify where on the page you want it to appear, but you would have to provide a little more information for us to be able to go into any more detail than that.

 

Ryan

The menu would be in a div. I was thinking center aligned, between the title of the page and the main content.

 

So in theory, I could use absolute positioning to move it up. I may give it a try. I do want the code to be able to expand/collapse without problems, so I was a bit hesitant to start using positioning in that way (not very flexible).

 

 

If you want the menu at the top of the page it isn't very important where the code lies in the markup.

 

- Make sure your container div is "position:relative".

- You can then either choose to wrap the list in a div, which you then give an id/class, or give an id/class to the list.

 

You can then use css to "position:absolute" to place the menu within the container. So it might look something like this:

 

ul#nav {
position:absolute;
top:0;
right:0;
list-style:none;
margin:0;
padding:0;
width:700px;
height:50px;}

 

With this you can move the menu to any location within the container div irrespective of the where the code for the menu appears in the markup.

  • 1 month later...

The top of the page is easy, because of the absolute position.

But the menu would reside after the header (logo + other things) from the page.

And since I typically let the height and width as flexible/fluid em based, then absolute positioning becomes pretty much impossible.

 

Maybe I'll redesign so the menu remains at the very top, but that seems awkward. Maybe just attempt to fix the height of the header, and use different coordinates for the position.

 

Thanks.

absolute positioning is teh key here - you can just set the 'top' to be the height of the header element then it will appear below it...

 

this may be useful http://www.barelyfitz.com/screencast/html-training/css/positioning/[/ul]

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.