Skip to content Skip to sidebar Skip to footer

Css Equivalent Of Table Rowspan With Fluid Height

I'm trying to accomplish the following using CSS: As A Row

I need your help, if the following code below counts every …
This row should equal the height (no fixed-height allo

Solution 1:

First of all, what you are doing looks like a table to me, so you might want to consider that. Doing it with CSS however is a bit more tricky (unless you do the table styling in CSS). The following code works but does not center vertically the text in the box:

<html><head><title>Test2</title></head><body><divstyle="width:300px; padding: 2px; border: 1px solid black;"><divstyle="float:right; width: 100px;"><divstyle="border: 1px solid black; margin-bottom: 2px;">
      Here is some sample text. And some additional sample text.
    </div><divstyle="border: 1px solid black;">
      Here is some sample text. And some additional sample text.
    </div></div><divstyle="border: 1px solid black; margin-right: 102px;"><div>
      This column should equal the height (no fixed-height allowed) of the 2 rows sitting to the right.
    </div><divstyle="clear: right; margin-bottom: -1px;"></div></div></div></body></html>

Table cells in CSS are easier:

<!DOCTYPE html><html><head><title>Test2</title></head><body><divstyle="display: table; width:300px; border: 1px solid black; border-spacing: 2px;"><divstyle="display: table-cell; border: 1px solid black; vertical-align: middle;">
    This column should equal the height (no fixed-height allowed) of the 2 rows sitting to the right.
  </div><divstyle="display: table-cell; width: 100px;"><divstyle="border: 1px solid black; margin-bottom: 2px;">
      Here is some sample text. And some additional sample text.
    </div><divstyle="border: 1px solid black;">
      Here is some sample text. And some additional sample text.
    </div></div></div></body></html>

Solution 2:

I needed something very similar. Unfortunately all these solutions are pretty complex, I came with something very simple (maybe too simple) -- used display: inline-block

HTML

<div><spanid="v">
        text in the left
    </span><divid="x"><div>upper row</div><div>lower row</div></div></div>

CSS

#x {
    display: inline-block;
    vertical-align: middle;
}

fiddle

Solution 3:

This is what I use: http://www.ejeliot.com/samples/equal-height-columns/example-7.html

I'd just use the second column as a wrapper for the other two elements (less-semantic). That should be the easiest way.

Post a Comment for "Css Equivalent Of Table Rowspan With Fluid Height"