html – 垂直对齐范围内div

参见英文答案 > How to center an element horizontally and vertically?10个
http://jsfiddle.net/UmHNL/2/
<div class="container">

    <span>Some text,yay</span>

</div>

<div class="container">

    <span>Some text,yay. But shit time,there is alot of text,so we get a problem with breaking lines and the given height :( How can I align vertical Now?</span>

</div>
<style>
.container {
    width: 100%;
    height: 50px;
    line-height: 50px;
    border: 1px solid black;
}

.container span {
    padding-left: 30px;
}
</style>

这个解决方案的效果非常好,直到屏幕宽度太小 – 将我的文本打破了几行.

当我google这个问题,我发现这么多疯狂的过于复杂的解决方案与javascript和div推我的内容到位.任何人可以帮助我做这项工作,而不增加更多的标记

相关文章

Mip是什么意思以及作用有哪些
怎么测试Mip页面运行情况
MIP安装的具体步骤有哪些
HTML添加超链接、锚点的方法及作用详解(附视频)
MIP的规则有哪些
Mip轮播图组件中的重要属性讲解