How can I stretch background image of a table cell with CSS? I have Googled it with no results.
When you set background image of a cell and the background size is smaller than the cell, then it will be repeated.
How can I force this background to stretch the entire table cell instead?
It is possible.
NOTE: This is using CSS3 and will not be supported by inferior browsers.
If you set your cell with this styling it should solve your problem. It will also allow for collapsible tables too because you're using %.
You can't stretch a background image.
If you want to stretch an image, you have to put it in an
img
tag. You can use absolute positioning to put content on top of the image.It is possible to stretch a background image using the
background-size
CSS property.Examples:
All major current browsers support the feature: