简体   繁体   English

阻止页面的所有内容调整大小

[英]Prevent all of my contents of the page from resizing

I'm trying to prevent all of the content on the page from moving, resizing while width page is under 1350 px. 我试图防止页面上的所有内容移动,而宽度页面小于1350 px时要调整大小。 Min-width doesn't work for this and i don't know why.. so what can i do ? 最小宽度对此不起作用,我也不知道为什么..那我该怎么办?

Btw on my css code, for the width, height, transformation: translate , i'm using the value vmax , and not px or % . 顺便说一句,在我的css代码上,表示width, height, transformation: translate ,我使用的是值vmax ,而不是px% So the min-width maybe doesn't work with it, all of my elements keep resizing because they are using vmax , so they just adapt there size with the window size too.. :( 所以min-width可能不起作用,我所有的元素都因为使用vmax而不断调整大小,因此它们也只是根据窗口大小来调整大小。

I tried this too, but still don't work :( 我也尝试过这个,但是仍然不起作用:(

body {
    min-width: 1350px; 
}

The code + preview 代码+预览

(I'm trying to stop resizing the three white rectangle in priority when my browser width is under 1350px, but if we can tell to the page to stop resize all of the content when she is under 1350px, and only use a scrollbar to deplace the elements on the page, it will be cool !) (当我的浏览器宽度小于1350px时,我试图停止优先调整三个白色矩形的大小,但是如果我们可以告诉页面在其小于1350px时停止调整所有内容的大小,并且仅使用滚动条来替换页面上的元素,这将很酷!)

See this page for exemple , when she is less than some px, the page stop from resizing and a scroll bar appear, i want the same result but i don't know how to do it ... 例如,请参见此页面 ,当她小于px时,页面停止调整大小并出现滚动条,我希望得到相同的结果,但我不知道该怎么做...

you are using css dimensions that are relative to the viewport. 您正在使用相对于视口的CSS尺寸。 vmax vmin, vh, vw are relative to the viewport and thus react to resizing of the window. vmax vmin,vh,vw相对于视口,因此对调整窗口大小有反应。 if you want fixed dimensions, you should use em or rem 如果要固定尺寸,则应使用emrem

edit: if you want to prevent the white boxes from resizing, you could add a min-width: 450px so they can grow but don't shrink beyond a point 编辑:如果要防止调整白框的大小,则可以添加min-width: 450px以便它们可以增长但不会缩小到一个点以上

vmax is not related to document size, but to actual browser size. vmax与文档大小无关,但与实际浏览器大小有关。 Maybe absolute units like px , rem , em are a better solution in this case. 在这种情况下,也许像pxremem这样的绝对单位是更好的解决方案。

For contional css, based on the specific width of the window, you can use media-queries: 对于常规css,根据窗口的特定宽度,可以使用media-queries:

@media only screen and (max-width: 1350px) {
    body {
        background-color: lightblue;
    }
}

That way, you'll be able to define sepcific rules for each resolution / rule that you want. 这样,您将能够为每个所需的分辨率/规则定义单独的规则。

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

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