-1
有人可以幫我弄清楚爲什麼我的徽標圖片沒有根據瀏覽器大小調整大小嗎?使用響應式佈局調整圖片大小
---------------- CSS ---------------------
body {
height: 100%;
background-color:#333;
}
#logo {
max-width: 100%;
}
img {
border: 0;
max-width: 100%;
height: auto;
}
#header-bg {
background-image: url("header-bg.png");
overflow: auto;
width: 100%;
}
- --------------- HTML -------------------
<body>
<div id="header-bg">
<div id="logo">
<img src="logo.png" />
</div>
</div>
</body>
當我將寬度設置爲100%時,它會在整個窗口上展開徽標。 – MG1 2013-02-12 16:41:51
@ MG1查看已更新的答案。希望有所幫助。 :) – 2013-02-12 16:43:40
我爲你創建了一個jsFiddle來展示@Praveen Kumar解釋:http://jsfiddle.net/persianturtle/4h2xU/1/ – 2013-02-12 16:53:46