Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Full height div inside td

Tags:

css

I want to achieve this thing: alt text

Height of table row and grey line should be dynamic depend on contents in right column.

I've read in How to make <div> fill <td> height, so I tried with this http://jsfiddle.net/hyNWy/

But still no luck. Any suggestions?

like image 486
Jeaf Gilbert Avatar asked Sep 30 '10 06:09

Jeaf Gilbert


People also ask

How to make TD automatically grow to the same height as Div?

If you give your TD a height of 1px, then the child div would have a heighted parent to calculate it's % from. Because your contents would be larger then 1px, the td would automatically grow, as would the div. Kinda a garbage hack, but I bet it would work. Show activity on this post.

How do I set the height of the <TD> tag?

For this to work, the <td> must have an explicit height set. */ height: 100%; } .thatSetsABackgroundWithAnIcon .theIcon { position: absolute; bottom: 0; right: 0; } If you keep the <div> as a child of the <td>, this snippet of jQuery will properly set its height:

How to make a <Div> fill the height of the remaining space?

How to Make a <div> Fill the Height of the Remaining Space 1. The most usual solution to this problem is to use Flexbox. Let’s see how to use it. For this method, we’ll need the... 2. Another way of making a <div> fill the remaining space is to use the CSS position property. Just set the position ...

How much padding between the TD and the Div?

There is 10px padding between the TD and the div. If I assign a BG image to the TD, I couldn’t create this ‘whitespace’ could I?


1 Answers

With a colon? Also, to get your spacing:

<td style="position:relative;">
    <div style="width: 10px; position:absolute; top:10px; bottom:10px; background:grey">
    </div>
</td>

EDIT:

I don't think it's possible without specifying an explicit height. The solution in the original question that you pointed to does not actually work. position:relative does not seem to apply correctly to table cells. This could well be intentional and part of the spec.

like image 84
Eric Avatar answered Dec 04 '22 11:12

Eric