简体   繁体   English

缩小浏览器大小时更改网站布局

[英]Change in website layout when reducing browser size

When I reduce the browser window size, the top and bottom footers start to shrink, pushing the content that is inside the footers (navigation bar on the top and the bottom) off the footer and it starts to overlap with the main text body. 当我减小浏览器窗口大小时,顶部和底部页脚开始缩小,将页脚内部的内容(顶部和底部的导航栏)推离页脚,并开始与主体文本重叠。 Does anyone know why this problem occurs? 有谁知道为什么会出现此问题? Apologies if this question is unclear or has been already answered, I'm still learning. 如果这个问题不清楚或已经回答,我深感抱歉,我仍在学习。 Many thanks for your help. 非常感谢您的帮助。

Most content on a web page will be resized like that when the window is made smaller. 像缩小窗口一样,将调整网页上大多数内容的大小。 What you can do is set the min-width CSS property to define a minimum width at which point the browser will add scroll bars rather than resize the elements on the page. 您可以做的是设置min-width CSS属性,以定义最小宽度,此时浏览器将添加滚动条,而不是调整页面上元素的大小。 SO something like: 所以像这样:

.someClass {
  min-width: 800px:
}

I think you can customize all your CSS rules using the % ,So in case of the parent element's width is reduced by 400px for ex , you can set childs width,height,margine,etc by % values like this : 我认为您可以使用%来自定义所有CSS规则,因此如果ex的父元素的宽度减少了400px,则可以通过%值设置子元素的width,height,margine等,如下所示:

.parent{
  width:100%;
}
.child{
  width:60%;
}

Let's assume that the parent 100% represents 1024 px ,So Child will take 614 px and when the page is re-sized and takes 600 px ,So child will be 360 px automatically 假设父级100%代表1024 px,因此子级将占614 px,而页面调整大小后将占600 px,因此子级将自动变为360 px

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

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