Good time of day. Such a question about the layout and optimization. On the page there is a block that is displayed only in the mobile version of the site. On the desktop version, it is display: none. I decided that it would not be a bad idea to write a display non to this block on an HTML file.

<div class="mobbody" style="display:none"> .... </div> 

The question is: How to block the display non? Through the media query (there is a viewport) change display: none for example display: flex / block, etc. In the prescribed media query, the screen size is less (conditionally) 720px, the style is not assigned even with the use of! Important. Maybe I'm coming from the wrong side. Please tell me

1 answer 1

spelled correctly! important and it should work. But this is not the best option - writing styles directly in html, and the use of! Important is not recommended. It is better to list display: none for the standard image in the css-file, and in the media query for mobile display: flex / block