Jump to content
  • Advertisement
Sign in to follow this  
iaminternets

I have a very basic CSS question! :]

This topic is 3497 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

<html>
  <body>
    <div style="background-color:red;position:absolute;width:400px;top:50%">
      [non-breaking-space]
      <div style="background-color:blue;width:50px;position:relative;top:-50%;">
        [non-breaking-space]          
      </div>
      [non-breaking-space]
    </div>
  </body>
</html>





Aparently, in Firefox, if an element isn't absolute:positioned, you can't use percentage units with the top property. It's frustrating! I'm trying to vertically center images (yes, the above code is incomplete, but it demonstrates my point about percentage units); is there a work-around? EDIT: I'm sorry for the initial post; I wasn't quite sure how I was supposed to post HTML! [Edited by - iaminternets on October 24, 2008 9:52:39 PM]

Share this post


Link to post
Share on other sites
Advertisement
Thanks for the reply! ++rep

I'll probably just end up using the solution that article provided, but why won't 'top' accept a percentage value if the element isn't absolutely positioned?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!