White Maskers White Maskers - 24 days ago 9
CSS Question

Is it possible to remove class of an element when change the screen size?

I'm working on a menu bar @ which initially which have a width property and when the screen size is less than 767(

@media screen and (max-width:767px)
) I need to remove that property.so I'm trying to implement that using a class.the height property is specified in this class and want to remove that class when width is less than
767px
.Is it possible to remove class of an element when change the screen size?.

Answer

You don't necessarily need javascript if you only want to change the properties.

Write the styling of that class inside a media query e.g

@media screen and (min-width:768px){
// i am usign MIN-WIDTH:786px not MAX-WIDTH
.yourclass{
float: right;
}
}

So this property will be added to that element ONLY on screens greater than 786.