Solution 1 :

You have to add tag style and write inside it your @media css code, for example

<div>Element</div>
<style>
@media (max-width:360px){
    div{
      display: none;
    }
}
</style>

Solution 2 :

No.

The value of a style attribute is equivalent to the body of a rule-set.

Rule-sets can go inside media queries. The reverse is not true.

Problem :

I have a problem in which i need to use @media in html. You use @media in css but now i need to use it in html but i cannot find a way on how to do so.

I expect to change some styling

Comments

Comment posted by caTS

No, you can’t inline

Comment posted by Sarah

use it in a

Comment posted by awd

can’t use “id or class” therefore style won’t work

Comment posted by Quentin

There are many selectors other than ID and class selectors. They can be combined in many ways. (And if you can change the HTML to add a style attribute then you should be able to add other data too).

Comment posted by ethry

No, you can’t. Just use a

By