Reputation: 327
Seems like i've done everything correctly, but it just wouldn't not work. It doesn't display when inspecting element as well. To check if it's media query, tried setting a different bg color.
@media screen and (max-width:1050px) {
#hmbn {
width:400px !important;
background-color:red !important;
}
}
The div is placed inside bootstrap row
Upvotes: 0
Views: 1809
Reputation: 36742
This is caused by the floating elements within #hmbn
Bootstrap has a buiilt in clearfix. Add the class clearfix
to #hmbn
<div id="hmbn" class="clearfix">
...
</div>
The following no longer applies after the question was edited...
Remove the ;
@media screen (max-width:1050px) {
Upvotes: 2
Reputation: 28554
Here you go.
@media screen and (max-width:1050px) {
#hmbn {
width:400px;
background-color:red;
}
.im1fill {
float:none;
}
}
Explanation: #hmbn
didn't receive I height, which was caused by a
not displaying as block, which was caused by the floating of the divs inside the anchors. Remove the float, and you fix everything. You can get rid of the !important
tags as well.
Upvotes: 0
Reputation: 22663
Try this it will work fine!
@media (max-width: 1050px) {
#hmbn {
width:400px;
background-color:red;
}
}
VERY IMPORTANT:
this will work fine:DEMO
@media (max-width: 1050px) {/*1.position*/
#hmbn {
width:400px;
background-color:red;
}
}
@media (max-width: 650px) {/*2.position*/
#hmbn {
width:40px;
background-color:orange;
}
}
@media (max-width: 480px) {/*2.position*/
#hmbn {
width:10px;
background-color:green;
}
}
because the computer is reading it from the top to the bottom and overwrite the style
this will not work: DEMO
@media (max-width: 480px) {/*1.position*/
#hmbn {
width:10px;
background-color:green;
}
}
@media (max-width: 650px) {/*2.position*/
#hmbn {
width:40px;
background-color:orange;
}
}
@media (max-width: 1050px) {/*3.position*/
#hmbn {
width:400px;
background-color:red;
}
}
Upvotes: 0