# xhtml/css navbar problems

**URL:** https://boards.straightdope.com/t/xhtml-css-navbar-problems/412907
**Category:** Factual Questions
**Created:** [July 24, 2007, 12:01am UTC](https://boards.straightdope.com/t/xhtml-css-navbar-problems/412907 "2007-07-24T00:01:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![dart](https://avatars.discourse-cdn.com/v4/letter/d/7bcc69/32.png) [@dart](https://boards.straightdope.com/u/dart)
#### Post date: [July 24, 2007, 12:01am UTC](https://boards.straightdope.com/t/xhtml-css-navbar-problems/412907/1 "2007-07-24T00:01:23Z")

</div>

## I’m trying to teach myself xhtml/css, and the page I’m working on now has this code in the html:

\<body\>

\<div class=“headimg”\>  
\<a href=“ualc.html”\>\<img src=“4\_keys.jpg” alt=“Main”\</a\>  
\</div\>

## \<h1\>\<img src=“keyhole.jpg” /\>\</h1\>

“headimg” is a banner image that goes about three quarters of the page across, sitting to the left. To the right is the navbar, which is a vertical column of images (flags). I want the flags to go up to the top of the page, so that some of them are on a level with the “headimg” image, but I can’t get them to. The image isn’t actually as wide as the page, so I’m not sure why. Here is the css for the navbar:  
------------------------------=

div#navbar {  
height: 0px;  
width: 100%;  
text-decoration: none;  
margin-top: none;  
float: right  
}

a:link {  
text-decoration: none;  
}

a:hover {  
text-decoration: none  
}

img {  
border: 0;  
}

div#navbar ul {  
margin: 0px;  
padding: 0px;  
font-family: tahoma, verdana, arial, sans-serif;  
font-size: small;  
color: #fff;  
text-decoration: none;  
line-height: 30px;  
}

## div#navbar li { list-style-type: none; margin-left: 810px; margin-top: 0px; text-decoration: none }

Thanks for any help, and sorry if this question is dumb—I’m really just making it up as I go.

---

<div class="post-metadata">

### Author: ![I\_m\_Ron\_Burgundy](https://avatars.discourse-cdn.com/v4/letter/i/9fc29f/32.png) [@I\_m\_Ron\_Burgundy](https://boards.straightdope.com/u/I_m_Ron_Burgundy)
#### Post date: [July 24, 2007, 12:10am UTC](https://boards.straightdope.com/t/xhtml-css-navbar-problems/412907/2 "2007-07-24T00:10:54Z")

</div>

float the header image left and float the navbar right. Follow them with a clear ( \<div style=“clear:both”\>\</div\> )if you don’t want anything underneath it to leak back up.

You don’t need to put div#navbar, you can just put #navbar. I’ve never seen that before but I don’t think it is part of the problem.

Nothing else is going to fit next to your navbar if it’s set to width: 100%. If the image is 3/4 the page, set the navbar to 25%.
