Web front-end development layout: first look, the simplest left and right Layout. may also be asked by the interview Hahaha. See also nothing special, is fixed on the left, the right self-adaptation, so Simple.
Principle: by setting a margin-left, or margin-right can be done. There are many ways to do this, and this time only introduces this set of Margin.
Code:
<!doctype html><html> <head> <metacharset="UTF-8"> <title>Document</title> <style> body{ margin:0; padding:0; } #wrap { overflow: hidden; *zoom: 1; } #content ,#sidebar { #eee; } #sidebar { float: left; width: 300px; background-color:pink; position:fixed; top:50px; left:0; } #content { margin-left: 310px; height:1000px; background-color:#e456aa; margin-top:50px; } #footer { background-color: #f00; color:#fff; margin-top: 1em; } </style> </head> <body> <divstyle="width:100%;height:50px;line-height:50px;background-color:#ccc;position:fixed;top:0;left:0;">这是头部:web前端开发大全</div> <divid="wrap"> <divid="sidebar"style="height:600px;">固定宽度区:号:jingfeng18</div> <divid="content"style="height:1340px;">自适应区</div> </div> <divid="footer">这是尾部,想写什么就写什么,这是一个神奇的地方</div> </body> </html> |
Very simple, If you have a better way, welcome to come to the exchange of Contributions. Only for learning more, technology to a higher level, an early rise in salary, win white Rich beauty, embark on the pinnacle of Life. Learn more front-end technology is in: Web front-end development View Daquan
Please remember our website: http://www.qianduanshiping.com no.: jingfeng18
Div CSS left fixed right adaptive layout