Baxtex Posted April 11, 2014 Share Posted April 11, 2014 (edited) Okay so I got this horizontal menu bar which I had positioned with absolute:relative to put it were I want it. It stays in place when resizing the browser windows left and right but not up and down as my menu seem to float up or down. I tried switching to position:fixed but it doesn't work either. When I got divs that are either relative or fixed I can't seem to move them either up or down only at the sides. I can move them up and down with absolute, but that makes them move when I resize my window. Here is the code; <div id="mainmenu"> <ul> <li><a href="#">Om oss</a></li> <li><a href="#">Öppettider</a></li> <li><a href="#">Hitta hit</a></li> <li><a href="#">Kontakta oss</a></li> </ul> </div> #mainmenu{background-color:black;width:600px;font-size:1.2em;font-weight:bold;text-align:left;border-radius:2px;margin:40px auto;position:absolute;top:17%;left:19%;} Edited April 11, 2014 by Baxtex Link to comment Share on other sites More sharing options...
Baxtex Posted April 11, 2014 Author Share Posted April 11, 2014 (edited) Solved it, I set the height with pixels and the width with % instead. Edited April 11, 2014 by Baxtex Link to comment Share on other sites More sharing options...
davej Posted April 11, 2014 Share Posted April 11, 2014 You should not use absolute or relative positioning unless you really need something special such as to position one element on top of another element. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now