Jazztronik
02-10-2010, 06:43 AM
Ihave a layout of three columns: left (25%), main (50%), right (25%). But depending on the chosen option, the right column might be needless and only "left" and "main" would have to be displayed with 25% and 75% for their widths respectively.
So I cannot simply assign them:
#left {
float:left;
width:25%;
}
#main {
float:left;
width:50%;
}
#right {
float:left;
width:25%;
}
Because in those case in which the right column is not displayed, the other two would remain constrained to their initial widths and a right gap of 25% the width would remain.
So I tried with this:
#left {
float:left;
width:25%;
}
#main {
float:left;
min-width:50%;
max-width:75%;
}
#right {
float:left;
width:25%;
}
Now the main column expands to occupy the room left by the right column when this one is not displayed, but when this one has to be displayed, it appeard below on the left (the main column doesn't compress to the initial 50%).
How can Ï fix this with CSS?
So I cannot simply assign them:
#left {
float:left;
width:25%;
}
#main {
float:left;
width:50%;
}
#right {
float:left;
width:25%;
}
Because in those case in which the right column is not displayed, the other two would remain constrained to their initial widths and a right gap of 25% the width would remain.
So I tried with this:
#left {
float:left;
width:25%;
}
#main {
float:left;
min-width:50%;
max-width:75%;
}
#right {
float:left;
width:25%;
}
Now the main column expands to occupy the room left by the right column when this one is not displayed, but when this one has to be displayed, it appeard below on the left (the main column doesn't compress to the initial 50%).
How can Ï fix this with CSS?