css對文字的布局上沒有靠容器底部對齊的參數,目前使用的一個不錯的方法也比較好.就是用position屬性來解決,看下面的代碼,用position的相對和絕對定位功能也輕松的實現了,文字靠近div低部對齊,並且靠近的距離還可以精確到像素,自己可以調節,是不是很不錯呢?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<!
DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<
html
>
<
head
>
<
meta
http-equiv="Content-Type" content="text/html; charset=gb2312">
<
title
>無標題文檔</
title
>
<
style
type="text/css">
#txt{
height:300px;
width:300px;
border:1px solid #333333;
text-align:center;
position:relative
}
#txt p{
position:absolute;
bottom:0px;
padding:0px;
margin:0px
}
</
style
>
</
head
>
<
body
>
<
div
id=txt>
<
p
>aadsad</
p
>
</
div
>
</
body
>
</
html
>
|