css中图片如何在局中
有很多种方法可以实现。随便写几种。------------------------------css部分:.text{background-image;url(pic.jpg);width: xx px /*你自己定义的宽*/height: xx px /*你自己定义的高*/overflow:hidden; /*超出部分隐藏*/}.text span{margin-top:xx px;/*离上边距离*/margin-left:xx px;/*离左边距离*/}html部分:<div class="text"><span>字</span></div> ------------------------------css部分:.text{background-image;url(pic.jpg);width: xx px /*你自己定义的宽*/height: xx px /*你自己定义的高*/position:relative;; /*相对定位*/}.text span{position:absolute;/*绝对定位*/top:xx px;/*离上边距离*/left:xx px;/*离左边距离*/}html部分:<div class="text"><span>字</span></div> --------------------------------------css部分:.text{background-image;url(pic.jpg);width: xx px /*注意,这里是你自己定义的宽减去padding-left的值*/height: xx px /*注意,这里是你你自己定义的高减去padding-top的值*/padding-top:xx px; /*离上边距离*/padding-left:xx px; /*离左边距离*/}html部分:<div class="text">字</div> lz自己选吧。
body{text-align:center;}