.obj1a,
.obj2b,
.obj3c
{
border: 1px solid #c6ffc7;
}
.obj1a:hover:not(:focus),
.obj2b:hover:not(:focus),
.obj3c:hover:not(:focus)
{
border: 1px solid white;
outline: 2px solid white;
}
.obj1a:focus,
.obj2b:focus,
.obj3c:focus
{
border-width: 3px;
}
The code above is what I’m currently using, and it works just fine. However, I was wondering if there’s any easier way to do it. Like using pseudo classes inside the css itself, like shown below. Is it possible to do something like that?
.obj1a,
.obj2b,
.obj3c
{
border: 1px solid #c6ffc7;
}
.obj1a,
.obj2b,
.obj3c
{
border:hover:not(:focus): 1px solid white;
outline:hover:not(:focus): 2px solid white;
border-width:focus: 3px;
}
2
Answers
Unfortunately, there is no such use. But you can build a different structure with SCSS:
That syntax is not allowed but you could simplify a bit the code using an attribute selector. Also, you could control the values using some custom properties (variables)