모바일 방문객에게 적합한 사이트가있어서 너비와 높이 모두 사용자 화면의 크기에 맞게 조정해야합니다. 또한 2 개의 탐색 메뉴 (왼쪽 1 개, 오른쪽 1 개) 및 바닥에 고정 정보 (예 : 바닥 글)가 있습니다. 이 모든 부분에는 이미지가 포함되어있어 메뉴의 크기에 맞게 크기를 조정해야합니다. 다음 CSS와CSS : 이미지가 포함 된 메뉴의 너비와 높이의 크기 (%)
<body>
<table class="wholepage">
<tr class="top">
<td class="left">
<table>
<tr><td><img src="http://apod.nasa.gov/apod/image/0304/bluemarble2k_big.jpg"/></td></tr>
<tr><td><img src="http://apod.nasa.gov/apod/image/0304/bluemarble2k_big.jpg"/></td></tr>
</table>
</td>
<td class="middle">Middle content</td>
<td class="right">
<table>
<tr><td><img src="http://apod.nasa.gov/apod/image/0304/bluemarble2k_big.jpg"/></td></tr>
<tr><td><img src="http://apod.nasa.gov/apod/image/0304/bluemarble2k_big.jpg"/></td></tr>
</table>
</td>
</tr>
<tr class="bottom">
<table>
<tr>
<td><img src="http://apod.nasa.gov/apod/image/0304/bluemarble2k_big.jpg"/></td>
<td><img src="http://apod.nasa.gov/apod/image/0304/bluemarble2k_big.jpg"/></td>
</tr>
</table>
</tr>
</table>
</body>
: 구체적으로, 페이지 (기본적으로 너무 큰 임의의 이미지 추가) 같은 것입니다 그와 마찬가지로
.wholepage {
width: 100%;
height: 100%;
}
.wholepage img {
width: 100%;
height: 100%;
}
.top {
height: 80%;
}
.left, .right {
width: 15%;
}
.middle {
width: 70%;
}
.bottom {
height: 20%;
}
이 페이지의 폭이 완벽하게 자신을 적응 , left-middle-right 사이의 15 % -70 % -15 % 분포를 유지합니다. 그러나 수직으로, 모든 이미지는 확장을 거부합니다. 페이지를 맨 위 바닥의 80 % -20 % 분포에 맞게 어떻게 얻을 수 있습니까?
편집 : 여기 http://www.w3schools.com/css/tryit.asp?filename=trycss_default
<html>
<head>
<style type="text/css">
html, body {
height: 100%;
}
.wholepage {
width: 100%;
height: 100%;
}
.wholepage img {
width: 100%;
}
.top {
height: 80%;
}
.left, .right {
width: 15%;
}
.left {
position: fixed;
top: 0px;
left: 0px;
}
.right {
position: fixed;
top: 0px;
right: 0px;
}
.middle {
width: 70%;
margin-left: auto;
margin-right: auto;
}
.bottom {
height: 20%;
position: fixed;
bottom: 0px;
}
</style>
</head>
<body>
<div class="wholepage">
<div class="top">
<div class="left">
<table>
<tr><td><img src="http://apod.nasa.gov/apod/image/0304/bluemarble2k_big.jpg" /></td></tr>
<tr><td><img src="http://apod.nasa.gov/apod/image/0304/bluemarble2k_big.jpg" /></td></tr>
</table>
</div>
<div class="middle">Middle content</div>
<div class="right">
<table>
<tr><td><img src="http://apod.nasa.gov/apod/image/0304/bluemarble2k_big.jpg" /></td></tr>
<tr><td><img src="http://apod.nasa.gov/apod/image/0304/bluemarble2k_big.jpg" /></td></tr>
</table>
</div>
</div>
<div class="bottom">
<table>
<tr>
<td><img src="http://apod.nasa.gov/apod/image/0304/bluemarble2k_big.jpg"/></td>
<td><img src="http://apod.nasa.gov/apod/image/0304/bluemarble2k_big.jpg"/></td>
</tr>
</table>
</div>
</div>
</body>
덕분에이를 기입하는 경우를 볼 수있는 방법입니다!
포인트를 찍었지만 html/body 높이를 100 %로 설정해도 이미지가 수직으로 축척되지 않습니다. – tb189
이미지에 'height = "100 %"및/또는 css 속성'img {height : 100 %; }'. –
그건 내가 CSS에 게시 :'.wholepage img {width : 100 %; 높이 : 100 %; }' – tb189