Home >Web Front-end >HTML Tutorial >How to implement this adaptive layout? _html/css_WEB-ITnose
The outer div is the same width as the browser (I know this), and it contains two divs, one on the left and one on the right. One div has a fixed pixel width, and the other has the remaining width (some pixels need to be margined). I know about float:left, but I don’t know how to write the remaining width at that time.
Cannot use js.
Use table
What I see
Use table
What I see is not using table, and now divs are generally used for layout.
For example, your left side is 120px. There are 2 elements on the page .left .right
The style is written like this
.left{float:left;width:120px;}
.right{margin-left:120px;width:100%;}
For example, your left side is 120px. There are 2 elements on the page .left .right
The style is written like this
.left{float:left;width:120px;}
.right{margin-left:120px;width:100%;}
I solved it myself, it's almost like this, but the key point is that the width of right is auto (just don't set it). If you do this, a horizontal scroll bar will appear. If you don't set it up, you can just use the remaining part.