<! DOCTYPE html>
<meta charset= "Utf-8"/>
<title>test</title>
<style>
*{
margin:0;
padding:0;
Color: #FFF;
}
. a{
Background: #FF0000;
width:100%;
Float:left;
margin-right:-100px;
}
. b{
Background: #006699;
width:100px;
Float:right;
}
. c{
Background: #006666;
margin-right:100px;
}
</style>
<body>
<div class= "A" ><div class= "C" > Left </div></div><div class= "B" > Right </div>
</body>
The above code is the right fixed width, the left adaptive width, margin-right:-100px also shows that the size of the floating element is affected by the margin, above a width is 100% width minus 100px
Here adaptive is the use of the size of the floating element can be adjusted by margin, if given margin-right negative, then the right will be trimmed to the corresponding width, so that the right side of the fixed width of the layout to leave the same size space
This visually is fixed floating on the right, the left adaptive float, but in fact, if there is no C element, but simply put the text into a, the text will run to the bottom of B, so I add C to a, and do not specify width, horizontal right margin to 100px, so that the text will not be overwritten, We can test it.