Modify status: focus from HTML


I wanted to modify the :focus status of an HTML element from the HTML tag itself. Let me explain, for example I can define the styles on the label itself:

<div style='background: grey'>

That in CSS would be equivalent to putting:

div {
   background: grey;

The problem is that I do not know how to modify the styles with the attributes :focus or :hover . In CSS I know what would be the following:

div:hover {
    color: white;

I'm trying with:

onmouseover=" 0 1px 1px #C27279;"

I can not get the new style to show.

asked by JetLagFox 28.05.2017 в 22:38

1 answer


It is not allowed to do hover with CSS inline. However, you can always use Javascript to achieve this through onmouseover and onmouseout .


   color: red;
<div onmouseover='"white"' onmouseout='"red"'>Esto es un texto</div>
answered by 28.05.2017 / 22:53