在CSS中定义浮动为中心
如何在CSS中定义浮动作为中心?实际上我需要左右之间的布局,而且我尝试了“文本对齐”,但它不起作用,而“浮动”属性刚刚起作用。
谢谢
How can I define a define float as center in css? actually i need a layout between right and left and also i tried "text-align" but it doesn't work and the "float" property just working.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你想要这样的东西:
关键是 text-align: center 在父元素上,而 margin: 0 auto 在内部元素上
You want something like this:
The key is text-align: center on the parent, and a margin: 0 auto on the inner element
您只能将元素向左或向右浮动。
也许描述一下你想要实现什么样的布局。
You can only float an element to the left or the right.
Maybe describe what kind of layout you are trying to achieve.
没有浮动:中心。但是当您希望 div 以其父级为中心时,这应该可以解决问题:
但是,您到底想要实现什么目标?
There is no float: center. but when you want a div to be centered to its parent this should do the trick:
but, what exactly are you trying to achieve?