简体   繁体   English

调整浏览器大小时停止abolute div移动

[英]Stop abolute divs moving when resizing the browser

I have created a relative container div with 100% width, it contains 5 div child elements in it. 我创建了一个具有100%宽度的相对容器div ,它包含5个div子元素。

I have set the child elements to absolute and set top and left pixel positioning. 我已将子元素设置为绝对,并设置了顶部和左侧像素位置。

However when I make my browser smaller my child elements move in and create scrollbars, I do not want this, I want the child elements to stay where they are for now, I do intend to learn media queries eventually but for now I just want them to stay where they are within the relative parent div . 但是,当我缩小浏览器的尺寸时,我的子元素将移动并创建滚动条,我不希望这样做,我希望子元素暂时保持原样,我打算最终学习媒体查询,但现在我只希望它们留在相对父div

Here is my test page: http://www.hotelmedeals.com/indexx.html 这是我的测试页: http : //www.hotelmedeals.com/indexx.html

You have given "left:" position in %, change them in pixel to keep them static... they are right now changing the left position as per % of the window when you reduce the size 您以%的形式指定了“ left:”位置,以像素为单位对其进行了更改,以使其保持静态...当减小尺寸时,它们现在根据窗口的百分比来更改左侧位置

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM