如果頁面縮小,我如何縮小網頁及其所有內容到中心? 這是縮小之前。 這是縮小
如何在整個頁面縮小時縮小整個頁面?
如何收縮到頁面的中心,而縮小後?使用
代碼IM是
<title>Demo</title>
<head>This is a demo</head>
<style>
#my-div{
margin-left: auto;
margin-right: auto;
width: 80%;
height: 50%;
}
#nav
{
background-color: red;
float: left;
width: 200px;
position:relative;
}
#detail
{
background-color: green;
float : right;
width: 800px;
position:relative;
}
div.testDetail
{
margin-top:10px;
margin-left:20px;
margin-right:20px;
margin-bottom:10px;
}
#container
{
width:1000px;
position:relative;
}
</style>
<hr>
<body style="background-color:blue";>
<div id="my-div">
<div id="container">
<div id="nav">
<ul>Tests</ul>
</div>
<div id="detail">
<div class="testDetail">
<image style="float:right;margin:5px;" src="test1.jpg" width="50px" height="50px"/>
<image style="float:right;margin:5px;" src="test2.jpg" width="50px" height="50px"/>
<image style="float:right;margin:5px;" src="test3.jpg" width="50px" height="50px"/>
<image style="float:right;margin:5px;" src="test4.jpg" width="50px" height="50px"/>
<h3>Title</h3>
<p>Testing</p>
</div>
</div>
<hr>
</div>
</div>
<body>
請提供示例代碼。您可以添加'margin:auto'來確保內容居中。 – phpheini
提供了代碼示例,以及迄今爲止您嘗試過的內容。 – LorDex
是的,我已經共享該示例代碼 –