After some research, I couldn't find an answer to this question. There was this but it didn't really answer my question. I would like to "strikethrough" a complete HTML table row in CSS, not just the text in it. Is it at all possible? From the example that I linked, it seems tr styling doesn't even work in Firefox. (And anyway, text-decoration only applies on text afaik)
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
- Adding a timeout to a render function in ReactJS
My answer (below) said that it is not possible. I was wrong, as pointed out by @NicoleMorganErickson. Please see her answer (and upvote it!) for how to do it. In short, you use
:before
pseudo-class to create an element that draws a border across the middle of the cell, above the content:(original answer)
No, it is not possible using only CSS and your semantic table markup. As @JMCCreative suggests, it is possible visually using any number of ways to position a line over your row.
I would instead suggest using a combination of
color
,background-color
,font-style:italic
and/ortext-decoration:line-through
to make the entire row obviously different. (I'd personally strongly 'fade out' the text to a color much closer to the background than normal text and make it italic.)Yes you can. In the first cell of the row you create a div containing a HR. Float the div to the left and specify its width as a % of its containing element, in this case the table cell. It'll stretch as wide as you want across the table cells in that row, even beyond the width of the table if you want.
This works for me:
To control the width of your line you have to specify the width of the table cell containing the HR. For styling HR elements they say you shouldn't make it less than 3px in height.
Oh yes, yes it is!
CSS:
HTML:
http://codepen.io/nericksx/pen/CKjbe
How about absolutely positioning an
<hr />
element overtop of the row. Depending on how static or dynamic this needs to be, it could be an extremely fast/easy way to go or much harder.I used http://www.patternify.com/ to generate the 1x1 image url.
The easiest way would be to use a
background-image
on thetr
and its descendant cells (or simply use a transparentbackground-color
on those cells).html:
css:
JS Fiddle demo