html图片文字下方,css图片下边怎么加字 | 您所在的位置:网站首页 › 病娇的壁纸加文字怎么弄 › html图片文字下方,css图片下边怎么加字 |
css图片下边怎么加字 比较简单的做法就是,将他们放置在一个盒子内,让文字跟图片居中,只需要利用css样式的text-align属性即可,并且各个浏览器都会正常显示,代码如下: 这里是居中的文字 .box{width:300px; text-align:center; font-size:14px;} .box img {width:100%;} (相关课程推荐:css视频教程) 还有一种方式,可以使用绝对定位position: absolute;让文字覆盖在图片上。 .box{ position: relative; } .box p{ font-size: 14px; position: absolute; bottom: 2px; width: 100%; text-align: center; } 居中文字 本文来自css3答疑栏目,欢迎学习! |
CopyRight 2018-2019 实验室设备网 版权所有 |