0
I’m trying to get a DIV
only be shown on small screens, then set the following:
@media screen and (max-width: 460px) {
#bloco{
display: block;
width: 100%;
height: 50px;
background-color: rgb(150,125,24);
}
outside the mediaquerie is
#bloco{
display:none;
width: 100%;
height: 50px;
background-color: rgb(230,25,24);
}
but it doesn’t work. I tested the opposite:
display:none;
in the standard css and
display: block;
at breakpoint and it worked, because this is happening?
Harry, how’s the content exactly? if the code that is valid for the other resolutions is after the midiaquerie, it will overwrite what you defined in it...
– Kenny Rafael
In the first code is missing close the keys.
– Taisbevalle
the code of the other resolutions is after. All media must be at the end, after the "main" code? why some attributes do not work?
– Harry Carvalho
@Taisbevalle I forgot to glue the lock of the key here, but in my code ta closed.
– Harry Carvalho
!Import and be happy.
– Mauro Alexandre
What exactly isn’t working ? Which attribute is being ignored ? It’s the
display
? Everything is in the same stylesheet ? How is the html of the elementbloco
, possesses somestyle
straight into html ?– MagicHat
At first, put all your midiaqueries at the end...
– Kenny Rafael
@Magichat the attribute
display:none
does not work. the div appears in larger screen, but does not appear in width less than 460px: I want exactly the opposite, only appear in small screen. It seems that the mediaquerie is being superimposed.– Harry Carvalho
Only with this fragment of code you have placed, I do not believe it is possible to state precisely the cause. Put the
html
andcss
of the respective page, and surely you will have the solution.– MagicHat
@Magichat followed the tip of kennyRafael and it worked. I put the midiaqueries at the end of CSS. Thanks to tds.
– Harry Carvalho
Thank you @Kennyrafael
– Harry Carvalho
Dispose.... ;)
– Kenny Rafael