當前位置:軟件學堂 > 資訊首頁 > 網絡編程 > DIV+CSS > 背景圖片定位css background-position屬性

背景圖片定位css background-position屬性

2012/11/24 19:21:43作者:佚名來源:網絡

移動端

【實例介紹】

背景圖片定位css background-position屬性

背景位置屬性用于設置背景圖像的位置,這個屬性只能應用于塊級元素和替換元素。替換元素包括img、input、textarea、selcet和object。

【基本語法】

background-position:位置取值

【語法介紹】

語法中的取值包括兩種,一種是采用數字,另一種是關鍵字描述。

【實例代碼】

<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>無標題文檔</title> </head> <style type="text/css"> .bj {  font-size: 13px;  line-height: 20px;  background-image: url(bb.jpg);  background-attachment: fixed;  background-repeat: no-repeat;  background-position: center 10px;} </style> <body class="bj"> <table width="500" border="0" cellspacing="0" cellpadding="0">   <tr>     <td>這里融入了我對親人、對身邊所有人的一種濃濃的愛;這里記載著我和身邊的故事,有著我的人生隨筆與感想;這里有著我一瞬間的靈感、不成熟的創作;這里記載著我不變的信仰,有著我對工作的滿腔熱愛;這里有著我樸素的人生觀,留下了我前進的足跡……</td>   </tr> </table> </body> </html>

【代碼分析】

在代碼中,加粗部分的background-position:center 10px標簽設置背景圖像的位置為水平居中對其.垂直位置為10像素,在瀏覽器中預覽效果,如圖所示。

背景圖片定位background-position運行效果

 【素材及源碼下載】

請點擊:背景圖片定位css background-position 下載本實例相關素材及源碼

 

標簽: 圖片    

欧美一级一极性活片免费观看,欧美一级艳片欧美精品,欧美一级性爱大片,欧美一级囗交视频 视频,欧美一级特黄录像视频