我想在我的html中使用背景圖片(bg.png),但我想調整圖片的大小,所以它會始終填充整個頁面。我這樣做是這樣的:如何調整body標記中的html背景圖片的大小
.stretch {
width:100%;
height:100%;}
#background {
width: 100%;
height: 100%;
position: fixed;
left: 0px;
top: 0px;
z-index: -1; }
身體裏面的:
<div id="background">
<img src="bg.png" class="stretch">
</div>
所以我在網站上使用CMS(E107),現在,我要像在我的HTML的背景下,我改變了圖片,但我不知道如何在css/php文件中使用它。
這是它的主題的CSS:
body
{
font-size: 12px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
width: 87%;
border-color: #39393b;
border-width: 0px;
border-style: solid;
color: #C0C0C0;
font-family: Verdana, Arial, Helvetica, sans-serif;
background-color: #444440;
text-align: center;
background-image: url(images/bg.png);
background-repeat: repeat-x;
}
我如何可以添加拉伸裏面這個CSS?
您可以使用背景尺寸:蓋;在你的身體上設置整個元素的bg.png。 – berentrom 2014-10-28 14:34:06