Formating Div by width of image inside it
How do i set the table under the images to be the same width as the image above? Thanks for your help!
http://cran-web.com/letaky/generate/10
EDIT: I was talking about "tab_cena", not "tab_objednavky". Sorry for m开发者_如何学编程isunderstanding.
Set the width of your table (#tab_objednavky) to 100%.
Currently your style shows that you have the width of your table set to 160%.
(Nazdar!)
There are only 2 kinds of measurements you can give the table: a fixed width like 1000px
, or a percentage like 100%
. If you give a fixed width, then you have to know the width of the items above (4 cells, 249px each). If you give a percentage, then it depends on the size of the element that contains your table.
You can use a percentage to your advantage. Since your table is in a 249px cell and you want it to stretch across 4 cells, try setting the width to 400%
. It's a little bit of a hack because you're breaking out of the cell container, but it should work.
A better way would be to make the .cell
equal 249px x 4 (996px
), and just make the #tab_objednavky
table inside it 100%
width.
Edit: to answer your question based on the title of your post: you can't do that without using JavaScript to set the size of the container div.
Not sure I am fully understanding, but #tab_objednavky
style you have width: 160%
. Just set that to width: 100%
and it will fill the .cell
container.
Looking at your layout it looks like the width of the image containers is set by the class .cell_1
, so just add it to your table and you should set. (Actually you should replace the existing cell
class that is already applied to it.)
Why don't you just place the image as the first row of the table?
精彩评论