我想在调整浏览器大小时编写一个媒体查询来为div设置不同的宽度。我希望这样做,因为我的引导程序无法按预期工作。有帮助吗?
html:
<div class = "column2 col-sm-10 col-xs-10">
<ng-view> Loading.. </ng-view>
</div>
CSS:
.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 */
}
我希望当浏览器宽度小于600px时发生这种情况。
答案 0 :(得分:2)
@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 */
}
}
答案 1 :(得分:1)
@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 */
}
}