问题描述
所以我一直在我的第一个网站,我有很多乐趣。
So I have been working on my first website, and I'm having lots of fun doing it.
但是,我发现很难实现将一个段落(跨越多行)垂直和水平地放在其div容器中。
However, I have found it very difficult to achieve centering a paragraph (spanning more than one line) vertically and horizontally inside of it's div container.
div具有比例宽度(96%),并且不是按像素设置。此外,段落有一个设置的填充量(例如:20px顶部和底部)。
The div has a proportional width (96%), and it is not set by pixels. Also, the paragraph has a set amount of padding (ex: 20px top and bottom).
在这种情况下,有垂直和水平中心的技巧吗?
Is there a trick to center vertically and horizontally in this situation?
感谢一堆!
推荐答案
你可以简单地使用text-align:center;在你的div。
You could have simply used text-align: center; on your div.
这篇关于如何中心段落垂直和水平w /其他标准?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!