css实现文字指定位置显示,底部对齐,文字在块内的垂直对齐
2014-07-23 16:40
453 查看
1.实现CSS文字底部对齐
2.文字在块内的垂直对齐,内容高度不固定,容器高度固定
参考地址:http://uecss.com/css-vertical-center.html
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>CSS实现文字底部对齐</title> <style type="text/css"> #txt{ height:246px; width:512px; border:1px solid #000000; position:relative } #txt p{ position:absolute; bottom:0px; padding:0px; margin:0px } </style> </head> <body> <div id="txt"> <p><a href="#" target="_blank">网页特效</a></p> </div> </body> </html>
2.文字在块内的垂直对齐,内容高度不固定,容器高度固定
<div class="cont"> <div class="inner">比较满意比较满意比较满意</div><div class="v">cssHack</div> </div>
* { margin: 0; padding: 0; } .cont { background-color: #ccc; font-size: 24px; height: 150px; text-align: center; overflow: hidden; width: 280px; } .cont .inner, .cont .v { display: inline-block; zoom: 1;*display: inline; /* 用于触发支持IE67 inline-block */ } .cont .inner { line-height: 1.8; padding: 0 4px 0 5px; vertical-align: middle; width: 262px; } .cont .v { line-height: 150px; text-indent:-9999px; width: 1px; }
参考地址:http://uecss.com/css-vertical-center.html
相关文章推荐
- 用css实现文字超出指定宽度显示省略号(...)
- Dataset实现在指定位置插入新行,并用DataGrid显示
- 1.3 实现图片压缩、添加文字或图片水印、指定位置裁剪等功能的ImageUtility(内有效果图) (转)
- 用DIV+CSS实现图文混排与文字列表一起显示
- 怎样用CSS来实现网页文字的两边对齐
- CSS实现文字超出宽度显示省略号
- QMessageBox 显示文字对齐的实现
- CSS+DIV实现文字一行内显示,并且过多的文字以点来代替
- css实现div自动添加滚动条(图片或文字等超出时显示)
- css实现文字过长显示省略号的方法
- 用DIV+CSS实现图文混排与文字列表一起显示
- 实现文字由右向左一个一个的变色输出,可有css+div来控制页面输出位置
- 用JavaScript实现层在指定位置显示
- css实现文字两端对齐(兼容)
- css+div文字底部对齐
- 1.3 实现图片压缩、添加文字或图片水印、指定位置裁剪等功能的ImageUtility(内有效果图)
- css 文字按钮实现样式submit按钮以文本的形式显示出来
- 用css实现图片与文字底边对齐[转帖]
- css实现图片与文字底边对齐
- translate实现图片运动,并显示在指定位置