Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.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
Javascript 调整窗口大小时使用媒体查询更改div宽度_Javascript_Jquery_Html_Css_Media Queries - Fatal编程技术网

Javascript 调整窗口大小时使用媒体查询更改div宽度

Javascript 调整窗口大小时使用媒体查询更改div宽度,javascript,jquery,html,css,media-queries,Javascript,Jquery,Html,Css,Media Queries,我想编写一个媒体查询,以便在调整浏览器大小时为div设置不同的宽度。我希望这样做,因为我的引导程序无法按预期工作。有什么帮助吗 html: <div class = "column2 col-sm-10 col-xs-10"> <ng-view> Loading.. </ng-view> </div> 我希望在浏览器宽度小于600px时发生这种情况。是的,使用媒体查询。您似乎已经回答了自己的问题-除了您的代码不包含任何媒体查询之外。@Ut

我想编写一个媒体查询,以便在调整浏览器大小时为div设置不同的宽度。我希望这样做,因为我的引导程序无法按预期工作。有什么帮助吗

html:

<div class = "column2 col-sm-10 col-xs-10">
    <ng-view> Loading.. </ng-view>
</div>

我希望在浏览器宽度小于600px时发生这种情况。

是的,使用媒体查询。您似乎已经回答了自己的问题-除了您的代码不包含任何媒体查询之外。@Utkanos我对媒体查询不太熟悉。你能告诉我怎么做吗?你研究过了吗?这几乎是最简单的MQ类型,会出现在任何入门教程中。我做了,但没有太多,因为我没有足够的时间。我不理解这种最大宽度的情况。顺便说一下,我找到了解决办法。谢谢
@media screen and (max-width: 600px) {
.column2
{
    width: 450px;
    float: left;
    background-color: white;
    height: 535px;
    border-radius: 5px;
    margin-top: 30px;
    overflow-y: auto;  /* Makes the scrollbar appear when it should be scrollable */
}

}
@media screen and (max-width: 600px) {
.column2
{
    width: 450px;
    float: left;
    background-color: white;
    height: 535px;
    border-radius: 5px;
    margin-top: 30px;
    overflow-y: auto;  /* Makes the scrollbar appear when it should be scrollable */
}

}
@media screen and (max-width:600px) {

    .column2
    {
    width: 450px;
    float: left;
    background-color: white;
    height: 535px;
    border-radius: 5px;
    margin-top: 30px;
    overflow-y: auto;  /* Makes the scrollbar appear when it should be      scrollable */
    }
}