我正在使用媒體查詢,並試圖瞭解有關響應式設計的更多信息。響應式設計 - 如何讓我的圖像左側佔用整個屏幕
媒體查詢CSS
@media screen
and (max-width: 480px){
#header .left {
float:none;
width:100%;
height: 100%;
}
#header .left img{
margin:0%;
width:100%;
height:auto;
}
#header .right {
float:none;
width:100%;
height:100%;
clear:both;
}
}
我經常CSS是這樣的:
#header .left{
width:17.95833335%;
float:left;
}
#header .left img{
margin:0%;
max-width:100%;
max-height:100%;
-moz-border-radius:5px 20px 5px; -webkit-border-radius:5px 20px 5px; border-radius:5px 20px 5px;
}
#header .right{
width:79.95833335%;
max-height:100%;
min-height:100%;
margin:0% 1%;
/*background-color: red;*/
background:
linear-gradient(27deg, #151515 5px, transparent 5px) 0 5px,
linear-gradient(207deg, #151515 5px, transparent 5px) 10px 0px,
linear-gradient(27deg, #222 5px, transparent 5px) 0px 10px,
linear-gradient(207deg, #222 5px, transparent 5px) 10px 5px,
linear-gradient(90deg, #1b1b1b 10px, transparent 10px),
linear-gradient(#1d1d1d 25%, #1a1a1a 25%, #1a1a1a 50%, transparent 50%, transparent 75%, #242424 75%, #242424);
background-color: #131313;
background-size: 20px 20px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
float:right;
}
HTML
<div class="left">
<img src="{{ url_for('static', filename='my_pic.jpg') }}" alt="My Pic" />
</div><!--left-->
<div class="right">
<h2>
Test test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test</h2>
</div><!--right-->
我想在右邊(.right
)向下移動的黑色區域,並在左邊(.left
)的圖像佔據整個屏幕。
我該如何做到這一點?
感謝
粘貼HTML代碼和創建的jsfiddle再現錯誤。 – Senthe