Have a small pen. Need to fill all <td>
with cellspacing. How can I do it?
On shortcut displayed the area, which I wanted to fill.
I didn’t quite understand you, but if you want to hover td, here:
td:hover{
background-color: ;
}
EDIT:
If you want to create a cellspacing table, you have to edit table tag, something like this:
<table cellspacing="10">
Now i need to disable hover for first <tr>
of the table…
My variation isn’t work((
Try this
tr:first-of-type td:hover {
background: #fff;
}
You have to target hover on td, not tr
Already done.
But I don’t understand, why if i set bg-color: #fff(without choosing a color for :hover) , color of text is becoming white too…
because when you put bgd on hover… the whole td is becoming white. You have to declare color.
Ok…
Thanks for answer)
You welcome mate
Keep coding
because you have
td:hover{
background-color: #4F4D5F;
color: white;
cursor: pointer;
}
The td:hover
css will get applied to all td
. You will need to overwrite it using css selector that is more specific than td:hover
. Using tr:first-of-type td:hover
is one way to do it.
2 other ways you can do it:
-
Using
tr + tr td:hover
selector instead of justtd:hover
. Because you know you will always skip the firsttr
and the firsttr
is always days. -
Using class on each
tr
.<tr class="day"></tr>
and<tr class="date"></tr>
.
.date td:hover {
background-color: #4F4D5F;
color: white;
cursor: pointer;
}
Personally, I’ll always prefer to have explicit class naming and rules than just using HTML as selector.
Thanks for the explanation