Reputation: 4006
I am trying to render HTML select box. I have 3 Div's inside table cell. Value
When the table expands the alignment of leftDiv and rightDiv is OK. But when the table shrinks below the size of two divs (leftDiv & rightDiv ) the rightDiv is rendering below the leftDiv.
How to make this two Divs stick together all the time?
Upvotes: 0
Views: 520
Reputation: 25820
You have few choices:
min-width: xxxx;
There are probably a few more methods you can google for.
Upvotes: 2
Reputation: 8244
Or this, if your table cell is a fixed width (100px in my example):
.leftDiv{width:50px;float:left;}
.rightDiv{width:50px;float:right;}
Upvotes: 0
Reputation: 1319
Set white-space:nowrap on the on the table cell. And white-space: normal on the divs themselves.
td.myClass {
white-space: nowrap;
}
#leftDiv , #rightDiv { whitespace: normal }
Upvotes: 0
Reputation: 398
You can specify the width of leftDiv & rightDiv with percentage, not pixels
.leftDiv {width: 50%}
.rightDiv {width: 50%}
Upvotes: 0