要解决这个问题,你将不得不借助 CSS。将每个元素的 css 样式设置为百分比。例如。让我们说下面的例子
<!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
<html lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
*{
margin:0;
padding:0;
}
html{
width:100%;
height:100%;
}
body{
width:100%;
height:100%;
}
.header{
position:relative;
background:blue;
width:100%;
height:20%;
}
.content{
position:relative;
background:pink;
width:100%;
height:60%;
}
.row1{
width:100%;
height:100%;
}
.footer{
position:relative;
background:green;
width:100%;
height:20%;
}
</style>
</div>
<div class="content">
<div class="row1">
<img
src="http://media1.santabanta.com/full1/Emotions/Love/love-130v.jpg" style="width:100%; height:100%" />
</div>
</div>
<div class="footer">
</div>
</body>
</html>