Reputation: 3657
I am trying to get my media queries to work properly, but the image
is displaying @ 100% of the screen (which I wanted), but the text on .right
is still float
ing from the original
declaration (see the white "text" on the right of the image).
Here's the media queries css
@media screen
and (max-width: 480px){
#header .header_adjust{
width:98%;
}
#header .header_adjust .left {
width:100%;
height: auto;
margin:0%;
background-color:red;
}
#header .left img{
margin:0%;
width:100%;
height:auto;
}
#header .header_adjust .right {
float:none;
width:100%;
height:auto;
clear:both;
margin:0%;
background-color:black;
}
}
original css:
#header .header_adjust {
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
#header .left{
width:17.95833335%;
float:left;
/* background-color: red;*/
}
#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="header_adjust">
<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 Tes
</h2>
</div><!--right-->
<div id="clear"> </div>
</div><!--header_adjust-->
Upvotes: 0
Views: 2415
Reputation: 540
With display: flex
, the child elements will be displayed side-by-side, even if they are not floated. See here: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
You can probably fix your problem by including this directive:
@media screen and (max-width: 480px) {
#header .header_adjust { display: block; }
}
Example: http://jsfiddle.net/pbosakov/apfy0nLw/
Upvotes: 1