pakmannen
10-29-2007, 07:03 PM
Hey people!
I'm having a bit of a problem positioning two things next to each other. Here's a picture of what I'm trying to do:
Horizontal bar (http://www.tjoff.com/jens/navbar.jpg)
If you look at the orange bar, you'll see I have a few text links on the left and a small form to the far right. Easy to do with a table and some valign properties, but I'd like to manage without.
The text links are an unordered list element. This is the markup:
<div id="nav">
<form action="">
<input type="text" />
<input type="password" />
<input type="submit" value="Logga in" class="button" />
</form>
<ul>
<li><a href="#">Artiklar</a></li>
<li class="current"><a href="#">Recensioner</a></li>
<li><a href="#">Nyheter</a></li>
</ul>
</div>
If I have to float something, I'd like it to be the form, because it will only be displayed if the user is not logged in. However, I can't get it to work with paddings and margins. This is what happens if I put float:right on the form: Horizontal bar (http://www.tjoff.com/jens/navbar2.jpg)
I ended up making it position:absolute, but that apparently broke something in IE. Is there an easy way to position things horizontally with a "valign" center sort of effect?
Cheers
I'm having a bit of a problem positioning two things next to each other. Here's a picture of what I'm trying to do:
Horizontal bar (http://www.tjoff.com/jens/navbar.jpg)
If you look at the orange bar, you'll see I have a few text links on the left and a small form to the far right. Easy to do with a table and some valign properties, but I'd like to manage without.
The text links are an unordered list element. This is the markup:
<div id="nav">
<form action="">
<input type="text" />
<input type="password" />
<input type="submit" value="Logga in" class="button" />
</form>
<ul>
<li><a href="#">Artiklar</a></li>
<li class="current"><a href="#">Recensioner</a></li>
<li><a href="#">Nyheter</a></li>
</ul>
</div>
If I have to float something, I'd like it to be the form, because it will only be displayed if the user is not logged in. However, I can't get it to work with paddings and margins. This is what happens if I put float:right on the form: Horizontal bar (http://www.tjoff.com/jens/navbar2.jpg)
I ended up making it position:absolute, but that apparently broke something in IE. Is there an easy way to position things horizontally with a "valign" center sort of effect?
Cheers