Click here to Skip to main content
15,898,790 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys, i have this HTML code
HTML
<div id="arrow-down"> </div>

the code works fine and i styled the <DIV> using css on a file named custom.css.
Here is the styling code;
CSS
div#arrow-down {
    width: 0;
    height: 0;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-top: 40px solid #2e3192;
    margin: 0% 46%;
}

The CSS code works fine, it creates an arrow facing down. the problem comes in the following code
CSS
@media all and (max-width: 768px) {
div#arrow-down
 {
   display: none !important;
 }
}


i want to make the arrow(div) to not display when being viewed on mobile devices. The code seems to work when i test it on the browser (developer tools) but for some reason the code does not work when i save it in the custom.css file, the arrow is still visible.

What I have tried:

Here is a list of alternate codes that i tried out

CSS
@media all and (max-width: 768px) {
div#arrow-down
 {
   visibility: collapse !important;
 }
}


CSS
@media all and (max-width: 768px) {
div#arrow-down
 {
   visibility: hidden !important;
 }
}


CSS
@media all and (max-width: 768px) {
div#arrow-down
 {
   border-top: 0px solid #2e3192; !important;
 }
}


all these codes work when i test it on the browser (developer tools) but not when i save it in the custom.css file.
what am i missing?
Posted
Updated 16-Oct-16 4:57am

1 solution

This Code was Working for my case.

you can also try to remove 'div'


#arrow-down {
width: 0;
height: 0;
border-left: 40px solid transparent;
border-right: 40px solid transparent;
border-top: 40px solid #2e3192;
margin: 0% 46%;
}


this was also working.
 
Share this answer
 
Comments
morojele 17-Oct-16 6:13am    
the proposed code does not produce the desired result, what i need is to make the arrow (div) disappear on mobile devices but thank you for your reply.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900