我遇到了一些不想創建換行符的文本問題:在縮小瀏覽器窗口時,它會使文本位於頂部。如何解決這個問題?如何創建換行符而不是文本自身?
見H1和對文本的位置:
http://jsfiddle.net/wWJqm/,並嘗試調整下你的瀏覽器窗口。
HTML:
<div class="meteor">
<img width="599" height="400" src="http://imageshack.com/a/img197/9543/2v8z.jpg" />
<h1><a href="" title="Nulla eu purus et orci">Nulla eu purus et orci</a></h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
CSS:
.meteor h1 {
position: absolute;
margin: 0;
top: 20px;
left: 30px;
font-size:24px;
line-height:1px;
text-align: center;
text-shadow: 1px 1px 0 #000;
padding: 2.3%;
background: #000;
}
.meteor p {
background: #000;
top: 50px;
left: 30px;
color: #fff;
line-height:1px;
margin: 0;
padding: 2%;
position: absolute;
text-align: center;
text-shadow: 1px 1px 1px #000;
}
如何使用媒體查詢? –