Jump to content

Menu positioning


Andy17

Recommended Posts

Hey guys,

 

 

I have a problem positioning my menu. Please click the link below to see my problem.

 

Link

 

I would like my menu to be on the right side of the logo (the light blue box) so the bottoms are aligned. To make sure you know what I mean, I made it in Paint:

 

this.JPG

 

Now my code...

 

HTML:

 

<html>

<head>

<link href="style.css" rel="stylesheet" type="text/css" />

</head>

<body>

       <div id="logo"></div>
        <div id="menu">
            <ul class="menu">
                <li><a href="/">Forside</a></li>
                <li><a href="/">Forum</a></li>
                <li><a href="/">Links</a></li>
                <li><a href="/">Kontakt</a></li>
            </ul>
        </div>

</body>

</html>

 

CSS:

 


body {
margin:0;
padding:0;
font-family: Arial, Helvetica, Verdana, Sans-serif;
}

#logo {
height:150px;
width:190px;
background-color:#DDF3FF;
}

#menu {
height:30px;
background-color:#555555;
margin: 0 auto;
}

.menu {
margin:0;
padding:0;
font: bold 14px Arial;
padding-top:6px;
}

.menu li {
display: inline;
}

.menu a {
color:white;
text-decoration:none;
padding-right:14px;
}

.menu a:hover {
color:red;
}

 

Any ideas how to get the menu up next to the logo so the bottoms are aligned?

 

Thanks in advance!

Link to comment
Share on other sites

Try this:

#logo
{
  background-color:#DDF3FF;
  float:left;
  height:150px;
  width:190px;
}

#menu
{
  //remove all styles from div#menu
}

ul.menu
{
  padding-left:0;
  position:relative;
  top:120px;
  height:30px;
  margin-left:190px;
  line-height:30px;
  background-color:#555555;
}

Link to comment
Share on other sites

I should add that you don't have a doctype in your document which is a big no-no. You should add one first. You will potentially find that the code I gave above won't work once you add a doctype, but you should add one anyways as it will save you plenty of headaches much further down the road.

Link to comment
Share on other sites

I should add that you don't have a doctype in your document which is a big no-no. You should add one first. You will potentially find that the code I gave above won't work once you add a doctype, but you should add one anyways as it will save you plenty of headaches much further down the road.

 

The code I posted here is only a small part of the design I am working on, so I just copied the relevant part into an HTML and CSS file and forgot to add the doctype. Thanks for the heads up, though. Your solution worked. I can always count on you, haku! :P Thanks!

Link to comment
Share on other sites

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.