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
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
關於我們
Yubis IT Solution 主要為客人設計網站,網站開發和網站寄存。我們以著名的Drupal CMS做為網站開發骨架,成功的例子有Sony BMG Music 的Myplay.com。
所有文章
更新日期: Oct-2009
更新日期: Aug-2009
更新日期: Jul-2009
- 1 of 7
- ››