Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 在我的网站上放大div';s移动_Css_Html_Zooming_Out - Fatal编程技术网

Css 在我的网站上放大div';s移动

Css 在我的网站上放大div';s移动,css,html,zooming,out,Css,Html,Zooming,Out,我是HTML和CSS新手,希望有人能帮助我。我有一个问题,这个网页的内容是不固定的地方,当我放大和缩小的容器自由移动。你知道怎么解决这个问题吗?不确定应该使用什么布局来防止这种情况发生。谢谢 <body> <img class="img" src="http://i824.photobucket.com/albums/zz162/nathanial292/banner_zps45abd080.png"> &l

我是HTML和CSS新手,希望有人能帮助我。我有一个问题,这个网页的内容是不固定的地方,当我放大和缩小的容器自由移动。你知道怎么解决这个问题吗?不确定应该使用什么布局来防止这种情况发生。谢谢

        <body>
            <img class="img" src="http://i824.photobucket.com/albums/zz162/nathanial292/banner_zps45abd080.png">    
        <div id="header">    
        <h3 id="header h3">    
             <a href="index.html">Home</a> Servers <a href="http://shoppingcart-28745.safestorefront.com/Merchant/?p1=201298">Shop</a> <a href="forum.html">Forum</a> About Us Contact    
        </h3>    
        </div>    
        <div class="left">    
            <h1>Server Updates</h1>    
            <h2><span>Hello readers</span></h2>     
        </div>    
        <div class="right">    
            <a id="nabblelink" href="http://hydronetworks-forums.58422.x6.nabble.com/">HydroNetworks Forums</a>    
        <script src="http://hydronetworks-forums.58422.x6.nabble.com/embed/f1"></script>    
        </div>    
        <div id="footer">All Rights Reserved 2013  HydroNetwork</div>    
    </body>    

放大时,内容会向右和向下移动,因为您使用了像素值

无论如何,你应该把它去掉
从您的HTML代码

并将其添加到CSS代码中:

body{
     background: url(http://i824.photobucket.com/albums/zz162/nathanial292/background_zps477e8756.png);
     background-position: top center;
}

如果您不希望缩放时div“移动”,则应使用百分比,如
width:50%

您好,我尝试使用%而不是px,但现在我的div高度似乎有问题。它似乎只使用了文本所需的高度,无论我怎样修改它,它都保持不变。因为你需要注意结构。如果您想固定每个显示的高度,请在CSS样式表中编写如下内容:html{height:100%}body{height:100%}#container{height 30%}。宽度也一样。如果仍然不起作用,则必须为每个元素定义{position:relative;display:block;}。
body{
     background: url(http://i824.photobucket.com/albums/zz162/nathanial292/background_zps477e8756.png);
     background-position: top center;
}