以流体布局居中放置容器ul / div [英] Center a container ul/div in a fluid layout

查看:111
本文介绍了以流体布局居中放置容器ul / div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一个容器div置于流畅的布局中(content:id:articles_grid必须居中):
http://www.benskesblog.com/projects/frontend/project/index.htm



我尝试了很多方法,但没有人工作。 (例如:margin:0 auto;)。

有人能告诉我如何解决这个问题吗?



谢谢

解决方案

我相信所做的改变非常简单,可以实现您所需要的功能:

  #articles_grid {
...
text-align:center; / *添加这个* /
}

#articles_grid li {
...
/ * float:left;删除这个* /
display:inline-block; / *添加此* /
}


I want to center a container div in a fluid lay-out (content with id: articles_grid has to be centered): http://www.benskesblog.com/projects/frontend/project/index.htm

I've tried a lot a methods, but no one did work. (for example: margin: 0 auto;).

Could someone tell me how to solve this?

Thanks

解决方案

I believe changes are pretty simple to achieve what you need:

#articles_grid {
...
text-align: center; /*add this*/
}

#articles_grid li {
...
/* float:left; remove this */
display: inline-block; /*add this*/
}

这篇关于以流体布局居中放置容器ul / div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆