css绝对定位后居中显示文字
生活随笔
收集整理的這篇文章主要介紹了
css绝对定位后居中显示文字
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
在圖片底部居中顯示文字,直接上代碼:
<style>.main {width:300px;height:200px;text-align:center;}.title {position:absolute;width:300px;height:20px;left: 0;right: 0;bottom: 0;background-color:rgba(0,0,0,0.5);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#7f000000,endColorstr=#7f000000);}#設(shè)置背景半透明并兼容ie瀏覽器 </style> <div class="main"><img src="1.png" /><p class="title">我要在圖片底部居中顯示</p> </div>效果如圖
總結(jié)
以上是生活随笔為你收集整理的css绝对定位后居中显示文字的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 家庭安防:待开发的处女地
- 下一篇: 前端自动化开发工作流