强制将内容对齐在中心 [英] Force align a content in center

查看:132
本文介绍了强制将内容对齐在中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些内容,其中将包含一些分割,标签,表单。我想强迫他们在页面的中心。

I have some content which will contain some divisions, labels, forms in it. I want to force them in the center of page. How can I do this?

注意:我尝试使用< div align =center> < center> 但无效果?

Note: I tried using <div align="center">, <center> but nothing works?

推荐答案

没有固定宽度,请执行以下操作:

If your content doesn't have a fixed width do this:

<div class="content">
 <div class="inner">some content</div>
</div>


.content
{
 text-align: center;
}
.inner
{
 display:inline-block;
}

如果有,您可以这样做:

If it does, you could do this:

.content
{
 width: xpx;
 margin: 0 auto;
}

这篇关于强制将内容对齐在中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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