Reputation: 5
I want to add a background color on a td
as a mouse hover in smarty.
How can I use create a hover I made a class for hover but its not working.
Help me out
Upvotes: 0
Views: 3102
Reputation: 42818
Here you go
td{
background:red;
color:white;
padding:10px;
border:1px solid white;
}
td:hover{
background:blue;
}
<table>
<tr>
<td>test</td>
<td>test</td>
</tr>
</table>
Upvotes: 0
Reputation: 1824
You can try this....
<style>
td.navon {
background-color: #999999;
cursor: hand}
td.navoff {
background-color: #FFFFFF}
</style>
<table>
<tr>
<td class="navoff" onmouseover="className='navon'" onmouseoff="className='navoff'">
td 1
</td>
</tr>
<tr>
<td class="navoff" onmouseover="className='navon'" onmouseoff="className='navoff'">
td 2
</td>
</tr>
</table>
Upvotes: 0
Reputation: 1824
<SCRIPT language="JavaScript">
function rollbg(chosen, objectID) {
if(chosen == "roll") {
document.getElementById(objectID).className="roll";
}
else {
document.getElementById(objectID).className="over";
}
}
</SCRIPT>
<STYLE>
.hlink {
display block;
height:20px;
width:75px;
color:black;
background-color:white;
text-align:center;
text-decoration:none;
}
.hlink:hover {
color:white;
background-color:black;
}
</STYLE>
Upvotes: 0
Reputation:
see the css :hover selector.
In your case:
td.yourClass { background-color: transparent; }
td.yourClass:hover { background-color: red; /* for example */ }
Upvotes: 7