2016-03-20 14 views
-3

ブラウザのサイズを変更するときに、divに異なる幅を設定するメディアクエリを書きたいと思います。私はブートストラップが意図したとおりに動作しないため、これを行う必要があります。どんな助け?ウィンドウのサイズ変更時にmediaクエリを使用して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

まあ、はい、メディアクエリを使用します。あなた自身の質問に答えたようです - あなたのコードにはメディアクエリーが含まれていません。 – Utkanos

+0

@Utkanos私はメディアの問い合わせに慣れていません。それをどうやって行うのか教えていただけますか? –

+0

調査しましたか?これはかなり単純な種類のMQであり、入門チュートリアルにも登場します。 – Utkanos

答えて

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 */ 
    } 
} 
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 */ 
} 

} 
関連する問題