473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

position menu left of main section

How do you position a navigation menu to the left of the main section?
My site has three div elements:

--------------------HTML---------------------
<body>
<div id="navigate">
<a href="./">Home</a>
<a href="bla/">Bla</a>
<a href="links.html">Links</a>
</div>

<div id="main">
<h1>Homepage</h1>
Welcome to my homepage!
</div>

<div id="footer">
</div>
</body>
--------------------HTML---------------------

(You can see the real homepage at http://jolowicz.com.)

These should be positioned as follows:

,------. ,---------------.
| nav | | |
| iga | | |
| te | | main |
`------' | |
| |
| |
| |
`---------------'
,--------------------------.
| footer |
`--------------------------'

My problem is that I don't know how to align the top of navigate and
main. The stylesheet below works well for Mozilla 1.7.5, but not for MS
IE. A friend says defining #navigate { [...] top: 1.4em; left: 0.8em; }
makes it look right in MS IE, but these dimensions don't actually align
on Mozilla. Another possible fix would be to position both navigate and
main absolutely, but then footer would be displayed below main (at the
top of the page).

By the way, is it OK to make navigate { position: absolute } without a
surrounding div which is { position: relative } ? Originally, main and
navigate were contained in a div corpus which was { position: relative
}, but this was reported to not work on MS IE :-( AFAIK, you need a
container which is { position: relative } as a reference for elements
with { position: absolute }.

---------------------CSS---------------------
/* Defines style for positioning */

body { padding: 0.5em }

#navigate {
position: absolute;
width: 8em; /* use the left margin in main */
}

#main {
margin-left: 10em; /* leave space for navigate */
}

#footer {
margin-top: 1em;
}

#navigate, #main, #footer { padding: 0.5em; }
#navigate a {
display: block;
margin-bottom: 0.3em;
}
---------------------CSS---------------------

--
,= ,-_-. =. Claudio Jolowicz
((_/)o o(\_)) http://www.jolowicz.com
`-'(. .)`-'
\_/
Jul 21 '05 #1
5 2413
Claudio Jolowicz wrote:
How do you position a navigation menu to the left of the main
section? My site has three div elements:


<snippage>

Have a look at this template from Ben Meadowcroft:

http://www.benmeadowcroft.com/webdev...ft-column.html

--
-bts
-This space intentionally left blank.
Jul 21 '05 #2
On Sun, 3 Apr 2005, Beauregard T. Shagnasty wrote:
Claudio Jolowicz wrote:
How do you position a navigation menu to the left of the main
section? My site has three div elements:
Have a look at this template from Ben Meadowcroft:

http://www.benmeadowcroft.com/webdev...ft-column.html


Thanks.

The template suggests to set top on #navigate (absolute position) and
margin-top on #main (static position) to the same size. I also needed to
remove the padding from body.

The resulting stylesheet works on Mozilla 1.7.5:

--------------------CSS--------------------
[...]
/* NEW: get rid of this */
/*body { padding: 0.5em }*/

#navigate {
position: absolute;
top: 1em;
left: 0.8em;
width: 8em; /* use the left padding space in main */
}

#main {
margin-top: 1em; /* NEW: match #navigate->top */
margin-left: 10em; /* leave space for navigate */
}
[...]
--------------------CSS--------------------

--
,= ,-_-. =. Claudio Jolowicz
((_/)o o(\_)) http://www.jolowicz.com
`-'(. .)`-'
\_/
Jul 21 '05 #3
On Sun, 3 Apr 2005 15:33:51 +0100, Claudio Jolowicz wrote:
On Sun, 3 Apr 2005, Beauregard T. Shagnasty wrote:
Claudio Jolowicz wrote:
How do you position a navigation menu to the left of the main
section? My site has three div elements:

Have a look at this template from Ben Meadowcroft:

http://www.benmeadowcroft.com/webdev...ft-column.html


Thanks.

The template suggests to set top on #navigate (absolute position) and
margin-top on #main (static position) to the same size. I also needed to
remove the padding from body.

The resulting stylesheet works on Mozilla 1.7.5:


Now that you have that working, try putting the #navigate after #main in
the HTML. It might still work, though the footer may cause problems.
If the look is still the same, then there is no downside, and your site
will probably work better for text browsers and search engines.

--
Greg Schmidt gr***@trawna.com
Trawna Publications http://www.trawna.com/
Jul 21 '05 #4
Greg Schmidt wrote:
Now that you have that working, try putting the #navigate after
#main in the HTML. It might still work, though the footer may
cause problems. If the look is still the same, then there is no
downside, and your site will probably work better for text browsers
and search engines.


Ben has a "3 Column & Footer" referenced there as well, which should
explain how to add a footer, in between the content and the menu HTML.
His templates seem to do well just about everywhere, and shows how to
linearize for text browsers and SE, as you mention. He does nice work.

--
-bts
-This space intentionally left blank.
Jul 21 '05 #5
On Sun, 03 Apr 2005 19:24:24 GMT, Beauregard T. Shagnasty wrote:
Greg Schmidt wrote:
Now that you have that working, try putting the #navigate after
#main in the HTML. It might still work, though the footer may
cause problems. If the look is still the same, then there is no
downside, and your site will probably work better for text browsers
and search engines.


Ben has a "3 Column & Footer" referenced there as well, which should
explain how to add a footer, in between the content and the menu HTML.
His templates seem to do well just about everywhere, and shows how to
linearize for text browsers and SE, as you mention. He does nice work.


Yeah, putting the footer between the content and the menu was the
compromise I've reached on some of my pages. I consider it a compromise
because it makes more sense to me, structurally, to have
content->menu->footer instead of content->footer->menu (although I guess
this depends on what is in the footer on a given page) but every other
method I tried involved a bigger compromise or else outright display
problems.

--
Greg Schmidt gr***@trawna.com
Trawna Publications http://www.trawna.com/
Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Peter Fjelsten | last post by:
Guys at comp.infosystems.www.authoring.stylesheets, I have designed a page in (x)HTML transitional that I am happy with in (close to) standard compliant browsers (i.e. Firebird/Opera), but IE...
8
by: Jaime Rios | last post by:
Hi, I created a COM AddIn for Word that performs the functions that it needs to, but I needed to add the ability for the toolbar created by the COM AddIn to remember it's last position and...
2
by: Joachim Bauer | last post by:
I'm using the code below to display a menu that opens when the mouse goes over the main menu item (try it in your browser to understand the behaviour). It uses "position:absolute" and a switch...
0
by: cabrenner | last post by:
First of all, I have been using the newsgroup to find answers to my development questions for several months, and it has been extremely helpful. I have an access app which closes all toolbars...
5
by: André Hänsel | last post by:
Hi, I want to make a horizontal navigation with the second level beneath the first level. The items of the second level shall appear left aligned with their corresponding first level item. To...
2
by: agbee1 | last post by:
Hello: I've finally made the effort to ween myself from overly using tables and use CSS for my positioning. However, I am having a problem with my navigational menu properly aligning in Firefox,...
2
by: DruManiac | last post by:
hi everyone, ive found a simple drop down menu script but for some reason there is only one div tag set for 2 menus.. and i want to position them seperately... ill give the css positioning of what i...
10
by: Mark | last post by:
According to my book on CSS, if you apply 'position: relative' to a block-level element, it will stay exactly where it is. However, you can then use top, left etc. to offset the element relative to...
2
by: slizorn | last post by:
hi guys, i need to make a tree traversal algorithm that would help me search the tree.. creating a method to search a tree to find the position of node and to return its pointer value basically i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.