Twin wings and grail layout
The literal meaning
- In popular terms, it is a three-column layout with fixed width of left and right columns and adaptive middle part.
Two kinds of layout essence
Grail layout implementation
- Let’s start with left, middle and right
- Give them three Settings float: left, out of the document flow;
- Be sure to set the container to overflow: Hidden; Can form A BFC split document
- Left and right set their widths
- Middle set width: 100%;
- Set position: relative for left, middle, and right;
- Container Setting padding: 0, rightWidth, 0, leftWidth;
- Margin-left: -100% for the left element and left: -leftwidth for the left element.
- Margin-left: -rightwidth for the right element, and left: rightWidth or right: -rightwidth for the right element.
The double flying wing layout is realized
- First put left, middle, and right inside middle
- Give them three Settings float: left, out of the document flow;
- Be sure to set the container to overflow: Hidden; Can form A BFC split document
- Left and right set their widths
- Middle set width: 100%;
- Inner set margin: 0, rightWidth, 0, leftWidth;
- Margin-left: -100%, right: -rightwidth;