Javascript 调整窗口大小时使用媒体查询更改div宽度
我想编写一个媒体查询,以便在调整浏览器大小时为div设置不同的宽度。我希望这样做,因为我的引导程序无法按预期工作。有什么帮助吗 html: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 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 */
}
}