Trying to use background size cover in a table and not getting the results I am after.
See: http://jsfiddle.net/pp9st63L/1/
.image th {
background-size: cover !important;
height: 300px;
width: auto;
}
The data columns (not including left most column) should be equal width, but the number of columns is variable. Sometimes 3 and other times 4 (including left headline column).
The width of these data columns should be equal and sufficient that the background image can cover. If there is any long data in the other. Currently the width of the columns is purely related to the data in those columns. I would like to override this behavior with CSS and set max widths for columns and make them equal width. So the background-size cover will work.
Any thoughts on how to get this to work?
Just delete
display:block
andmax-width
, usewidth
fortable cell
.background-size:cover
works for me. For some 'beautiful' you may also usebackground-position:50% 50%
orbackground-position:50% 0px
forimages
. Fortable-cells
samewidth
properties (30% 30% 30%
or30px 30px 30px 30px
) is a point to set thosewidth
always be the same.P.S. Sorry for my very bad English.
UPD
Also set
width
for the firstcol
Example
UPD 2
Please check, that
tr { td {...} }
was error. You should usetr td {...}
. Also check, that for set image properties you should usebackground-image
property intags
. Andwidth:auto
I wrote specially to show that you don't need setwidth
for narrow column to set it width to all other space of table. Alsowidth
fortable-cell
is amin-width
. So, text incells
can change thewidth
. Butit
could be change by hyphenation (word-wrap
).Example 2