如果页面缩小,我如何缩小网页及其所有内容到中心? 这是缩小之前。 这是缩小 如何在整个页面缩小时缩小整个页面?
如何收缩到页面的中心,而缩小后?使用
代码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
是的,我已经共享该示例代码 –