Ender
Ender

Reputation: 158

How to fill the space between two floating divs?

I have code:
<th colspan="3" />
<div class="l_table_th" /></div>
<div class="c_table_th" />Zamów pakiet punktów</div>
<div class="r_table_th"/ ></div>
</th>

left and right div's are necessary for rounded corners (by background, no CSS3) of HEADER for table. And my problem is: how to make center div fill all the space between them? width: 100% makes right div is falling to the next line. width: auto makes center div too short.

Upvotes: 4

Views: 3147

Answers (2)

cji
cji

Reputation: 6705

Try setting margins (left and right) for central <div>. Assuming that .l_table_th and .r_table_th are 15px wide, something like this should work:

<th colspan="3" />
   <div class="l_table_th"></div>
   <div class="r_table_th"></div>
   <div class="c_table_th">Zamów pakiet punktów</div>
</th>

.c_table_th {
    margin: 0 15px 0 15px;
}

.l_table_th {
    width: 15px;
    float: left;
}

.r_table_th {
    width: 15px;
    float: right;
}

Upvotes: 4

matpol
matpol

Reputation: 3074

wrap them in another div apply a background color?

Upvotes: 0

Related Questions