alessiop86
alessiop86

Reputation: 1305

Input text width to fill the remaining space

I have seen there are similar topics, but the solutions they offered did not work for me because I have another div between the textbox and the div that i wanna fill.

http://jsfiddle.net/m4MWD/1/

I would like the "Descrizione" input text to fill all the space to its right: i have tried to set the width to 100%

 <input style="width:100%" class="boxout" value="...." readonly="true" />

and it filled its parent div.label_e_campo, but not the main div I wanted to fill ( div.dettaglio_ente boxfun )

I was not even able to have the second (the one relative to the "Descrizione" field) div.label_e_campo 's width fill the remaining space in the line, as far as I have read, without setting a width it should automatically fill the parent, but it does not in my case.

Thanks

Upvotes: 2

Views: 653

Answers (1)

Chris
Chris

Reputation: 295

I have updated your fiddle here:

http://jsfiddle.net/m4MWD/3/

The Descrizione will not fill the parent, as you have a float on the parent. I have added a higher level wrap with the floats on.

#wrap1 {
float:left;
width:20%;
}
#wrap2 {
float:left;
width:78%;
margin-left:2%;
}

And then added this

div.label_e_campo input {
width:100%;
}

Does this work for you?

Upvotes: 3

Related Questions