清醒时做事,糊涂时读书,大怒时睡觉,无聊时关注图老师为大家准备的精彩内容。下面为大家推荐CSS教程:DIV底部放置文字,无聊中的都看过来。
【 tulaoshi.com - Web开发 】
css对文字的布局上没有靠容器底部对齐的参数,目前使用的一个不错的方法也比较好.就是用position属性来解决,看下面的代码,用position的相对和绝对定位功能也轻松的实现了,文字靠近div低部对齐,并且靠近的距离还可以精确到像素,自己可以调节,是不是很不错呢?
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/webkaifa/)!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 
paadsad/p 
/div 
/body 
/html
来源:http://www.tulaoshi.com/n/20160219/1629553.html
看过《CSS教程:DIV底部放置文字》的人还看了以下文章 更多>>