Remove ':hover' CSS behavior from element

后端 未结 6 1418
别那么骄傲
别那么骄傲 2020-11-29 16:57

I have CSS that changes formatting when you hover over an element.

HTML:

blah

CSS:

6条回答
  •  误落风尘
    2020-11-29 18:04

    I would use two classes. Keep your test class and add a second class called testhover which you only add to those you want to hover - alongside the test class. This isn't directly what you asked but without more context it feels like the best solution and is possibly the cleanest and simplest way of doing it.

    Example:

    .test {  border: 0px; }
    .testhover:hover {  border: 1px solid red; }
    blah
    blah
    blah

提交回复
热议问题