在圖片指定位置上輸出文字,不管在任何分辨率下文字的位置不變
1:要先將圖片的寬高寫固定,
2:將文字的標籤包在圖片的div中,利用padding-top確定文字的位置
說白了就是要將文字的位置相對圖片定位好就行了
html:
<div class="rewardBg"><p>23234</p></div>
css:
.rewardBg{background: url('/assets/p-default/images/act/score.png') no-repeat;width:226px;height:160px;background-size:100%;margin:0 auto;}
.rewardBg p{font-size: 30px;color:#fff;text-align: center;width:100%;padding-top:96px;}