There are three columns of div, with fixed width of 200px on both sides and adaptive width in the middle. The height of the three columns is stretched by the content and is always consistent with the height of the highest div.

A written test question, width adaptation knows that it can be done by flex or Grail layout, but the height is consistent with the maximum. I don"t know how to achieve it.

Sep.28,2021

this has been answered before

first of all, the flex layout is easy to implement. Answered upstairs

low-version browsers can also implement
you can use padding-bottom:9999px;margin-bottom:-9999px; to achieve the effect of alignment
implement

https://codepen.io/xboxyan/pe.


flex layout

<style>
.flex-row {display:flex;flex-direction:row;}
.flex-row > .flex-main {flex:1 1 auto;}
.flex-row > .flex-side {flex:0 0 auto;}
.side-left {width:200px;}
.side-right {width:200px;}
</style>
<div class="flex-row">
    <div class="flex-side side-left"></div>
    <div class="flex-main"></div>
    <div class="flex-side side-right"></div>
</div>

you have mentioned the flex layout, it is very simple, fixed width on both sides with min-width/max-width, height expansion with flex auto.

.container {
  display: flex;
}
.left, .right {
  min-width: 200px;
  max-width: 200px;
  flex: auto;
}
.center {
  flex: auto;
}

Note that the middle element sets the element on the edge of the flex auto, and only sets the width to be squeezed, so set min-width.


the default height of the flexchild element is the same as the parent;

align-items:flex-start | flex-end | center | baseline | stretch();
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b381cb-40675.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b381cb-40675.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?