-
Posts
4 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by slingsrat
-
-
The selectors you're showing apply to <tr> elements, which are rows, not cells. If you want to target cells you need to select <td> and <th> elements.
Table cells have their own behavior when being rendered:
- The width of a cell, including padding and borders, is the same as the width of all other cells in its column
- The height of a cell, including padding and borders, is the same for every cell in one same row.
- Cells take up as much horizontal space as necessary to fill up the width of the table they're in
I can use <td style="padding:5px"> at the start of every cell I want padded. I was looking for a single entry in a style sheet to do it.
-
What is in the cell?
Just text
-
I'm trying to add padding to every third cell
tr:nth-child(3n+2) {font-family: Arial; font-size: 10pt; padding: 10px; background-color: #0099ff; color: white}
tr:nth-child(3n) {color: white; text-align: right; font-size: 8pt}
th{font-family: Arial}The first line of code works apart from the padding attribute. How to pad selected cell?
padding in selected cells
in CSS
Posted
Oh thanks for figuring out what I wanted. I did forget to mention that every row was only one cell but you deduced that. Touché.