Formating Div by width of image inside it - css

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 misunderstanding.

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?

Related

table-layout:fixed auto width

I have a code as displayed in here : http://jsfiddle.net/db4XL/
The table-layout:fixed seems to divide the child elements into two 50% width.
Is there any posible way to make the div.number width is auto?
Please look at this image for what I want to achieve :
Thanks
This is not possible. If you want the table cells to resize to the content so the left cell is splitted at approx 30% then you'll have to use percentages. Here's a working jfiddle:
http://jsfiddle.net/db4XL/7/
What you are asking for just isn't possible. The standard behaviour for tables using the auto property on all cells is to divide it equally.

Img with max-height:100% stretches table with manually set height

This is minimal code example on jsfiddle.
Practically, I want to make a table 2x2 of images, fix its height and height of its rows and make images chose their size using max-width and max-height. But for some reason the table is bigger, than the div it's contained in and img height:100% makes it 100% it's high, but not container's. Why is it so? Where can I read about it?
It seems to work if you actually define the height in the height attribute of the table cell, like this:
<td height="20px">

Creating 4 concentric boxes with different background colors – only 2 of them appear

Why can't I show a box within a box, within a box, within a box, with 4 different background colors, 4 different div ids, I don't want to specify a width, I only see two colors when I should see 4?
Thanks for your help - Matthew
Whey can't I show tags? This is kind of complicated!!!!
A block element will fill out the dimensions of its parent element unless there are explicit widths set or there is padding inside a containing element. So if you have divs inside divs, make sure you have padding in the containing divs set (if you're not going to set explicit widths)
you must set some min-height and min-width style and then you can give proper style each div
DEMO
You need to specify a height. The div could be 0x0 and that's probably not what you want.
Below is an example of what we think you want but I specified a height and width.
http://jsfiddle.net/8T6KG
Update:
As recommended, I removed the width and height:
http://jsfiddle.net/8T6KG/3/
can you paste some sample code? plus, you can try setting the position to relative. And I think the outer most div needs to have some height and width set.

Auto adjust table row height keeping width fixed

I have a table containing many rows. I can allow a change in row height to fill the contents, but I want to keep my cell width fixed. Setting a max-width to cell solves the problem, but the content over flows to the next cell.. Can anybody have a solution in html/css or something else?
In addition to max-width, set overflow: hidden;. See http://jsfiddle.net/andyedinborough/nq7rA/1/

How can create a two-column layout in CSS where one column shrinks to it's content, and the other expands to fill the remaining space?

I have two <div>s on my page. I want to arrange them side-by side, so that the first (right) shrinks to fit it's contents (unknown width), and the second (left) expands to fill the remaining horizontal width.
The two columns do not need to be equal in height.
Additionally, I would like to create a 5px gap between the edges of the two boxes.
Is this layout possible without using a table?
EDIT:
Here's a table version to show you the kind of behavior I'm looking for.
I think one of my answers on another question solves this:
xHTML/CSS: How to make inner div get 100% width minus another div width
Am I understanding your question correctly?
Yes it is! You can float the first column left, and play with margins to create your gap.
http://innonesen.se/test/l-41-mod/
Ths should do it ( tested only on IE6 and Opera ).
Additional feature exist that the main container will stop expanding ,
when sidebar is less then 100px wide .
http://innonesen.se/test/l-41-mod/no-right.html
P.S. sorry , i cant past URLs .. my rep is too low.
Sure, here are two different fiddles showing how you could do it. The #float example uses a float: left and then a margin-left on the other div that equals the #float width.
The #absolute one uses one absolute column of fixed width and then the other column sets a margin-left that equals the #absolute column's width.

Resources