Showing posts with label it solutions. Show all posts
Showing posts with label it solutions. Show all posts

Friday, August 7, 2009

How to make Float center -- By yubis IT Solutions

When I was doing Drupal site for Yubis, I encounter this problem: Menu links or other HTML elements can be made float left / right, but is it possible to make it float center?

Unfortunately, there's no such thing in CSS! What we can do is to play with a little trick. The key is to identitfy this: Left 50% and Right 50%!

Consider a menu link as follows:


<ul>
<li>Main Page < / li>
<li>Second Page < /li>
< / u l>

First, we make ul {position: relative; right:50%}
What you'll see is the whole menu link shifts to the right!
Final stpe is to shift this whole thing 50% to the left. So, make things like:
li {position: relative; left:50%}

It's done. Check again your work and you'll see the whole menu now is placed at the center.

PS. Check another reference here: http://www.wowbox.com.tw/blog/article.asp?id=3008