centering menu in table - vertical -...

User 187934 Photo


Senior Advisor
20,266 posts
Online Now

Place you nav code inside another div and give that div the 100% and the same background color as the menu.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 187934 Photo


Senior Advisor
20,266 posts
Online Now

Try this. I'm giving the html and the CSS menu mnu file so you can make changes as needed.
Attachments:
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 629250 Photo


Registered User
50 posts

Here is my solution. The goal is a very simple horz. navigation bar for a site with only 4 or 5 pages. Google and on-line tutorials guided me. CC HTML Editor's Split Screen Preview tool made it easy to fine tune. Colors will need to be matched and actual links need to be added. Initial tests in the vendor's template look good.

Sometimes trying to take shortcuts makes things more difficult.

Thanks again for taking the time to help.

CSS in Header

<style type="text/css">

#navigation {
width:100%;
height:35px;
background-color:#006699;
font-family:verdana;
font-size:16px;
}

#navigation ul
{margin:0px; padding:8px;}

#navigation ul li {
display:inline;
height:30px;
float:left;
list-style:none;
margin-left:30px;
}

#navigation li a {
color:#ffffff; text-decoration:none;
}
#navigation li a:hover {
text-decoration:underline;
color:#003366;
}
#navigation li a:active {
text-decoration:none;
color:#003366;
}
</style>


HTML - List

<div id="navigation">
<ul>
<li class="active"><a href="#home">Home</a></li>
<li><a href="#product">Product</a></li>
<li><a href="#news">News</a></li>
<li><a href="#about">About Us</a></li>
<li><a href="#contact">Contact Us</a></li>
</ul>
</div>
User 122279 Photo


Senior Advisor
14,621 posts
Online Now

I see you have found a solution. :) I also notice the wee space to the left and right of the menu bar, which is due to every browser having its own margin/padding built in. If you want to get rid of that, and have the menu really go wall to wall, insert this at the top of your style sheet:
body {
margin: 0; }


And if you want to center your menu, change this in the css:
#navigation ul
{margin:auto; padding:8px;
width: 490px;
}
The 490px width comes from the width of the actual menu. So if you add a menu item (or subtract one), you will have to change the width accordingly. I usually add a temporary border: border: 1px solid red; or something, in order to better see what I'm doing.

A further hint would be to change the colour of the active and hover states of the links to something that is visible against the dark blue background.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com



Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.