Apply a class name in table
I know how to do this:
td {
border-right: 1px solid #C1DAD7开发者_如何学Python;
border-bottom: 1px solid #C1DAD7;
}
But i already have a separate css class called 'tdclass'. I have referenced it using <link type="text/css" rel="stylesheet"
. How do I apply this tdclass to td?
in your html you change the <td>
to <td class="tdclass">
Between the head tags of your htmlpage
<link rel="stylesheet" href="PATH_TO_YOUR_STYLESHEET.css" type="text/css">
In this css file you put
.tdclass{
WATHEVER CSS YOU NEED
}
to limit it to td tags with this class you could change it to:
td.tdclass{
WATHEVER CSS YOU NEED
}
Next in your HTML file add your class to each <td>
you want to apply it to like this:
<td class="tdclass">
You cannot apply a class through a CSS document. You need to add class="tdclass"
in the HTML portion.
In your CSS:
td { /*things to apply go in here */ }
or, in your HTML:
<td class="tdclass">
To use a class in HTML:
<td class="yourClassNameGoesHere"></td>
You can then reference that class in your CSS file with:
.yourClassNameGoesHere {
border-right:1px solid #C1DAD7;
...
}
To reference just table cells with that class, use
td.yourClassNameGoesHere {
...
}
精彩评论