With CSS it is possible, but you will need to remove the inline styling of the element, this is because the style defined in the style
attribute has higher priority than styles defined in CSS, (without using !important
).
a.obs-aluno {
display: none;
}
td.aluno:hover > a.obs-aluno {
display: inline;
}
<table>
<tr>
<td class="aluno" style="text-transform:uppercase">
Fulano
<a class="obs-aluno" href="#modal-obs">Link</a>
</td>
</tr>
</table>
Using !important
is possible, but its use should be avoided as it may cause debugging problems in the future.
td.aluno:hover > a.obs-aluno {
display: inline !important;
}
<table>
<tr>
<td class="aluno" style="text-transform:uppercase">
Fulano
<a class="obs-aluno" href="#modal-obs" style="display: none">Link</a>
</td>
</tr>
</table>
It's important to note the priority order of the styles:
Inline styles, set to style
;
Styles in CSS defined with id;
CSS styles defined with class;
CSS styles defined for the element;
See the examples below:
With all styles applied to the same elements, the style inline
will be prioritized.
a {
color: blue;
}
.yellow {
color: yellow;
}
#green {
color: green;
}
<a href="#" style="color: red" class="yellow" id="green">Link</a>
With the id, class, and element styles applied, id will be prioritized.
a {
color: blue;
}
.yellow {
color: yellow;
}
#green {
color: green;
}
<a href="#" class="yellow" id="green">Link</a>
With the class and element styles applied, the class will be prioritized.
a {
color: blue;
}
.yellow {
color: yellow;
}
#green {
color: green;
}
<a href="#" class="yellow">Link</a>
Element style is only applied when no other element is present.
a {
color: blue;
}
.yellow {
color: yellow;
}
#green {
color: green;
}
<a href="#">Link</a>
Further reading
Which css selector has priority