CSS page layout Getting Started Tutorial 6: Left column fixed, right column width Adaptive _ basic Tutorial

Source: Internet
Author: User
In the actual application, sometimes need left column fixed width, the right column according to the size of the browser window automatically adapt, in the CSS to implement such layout is simple and feasible, just set the width of the left column can be, as in the above example, the left and right columns are used to achieve the width of the adaptive, and we just need to set the left column width The right column does not set any width value, and the right column does not float, the code is as follows:
Copy CodeThe code is as follows:
#left {
Background-color: #E8F5FE;
border:1px solid #A9C9E2;
#right {
Background-color: #F2FDDB;
border:1px solid #A5CF3D;

In this way, the left column will render 100% width, and the right column will be adaptive to the browser window size.
<textarea id="runcode75713"><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "content=" text/html; charset=gb2312 "/> <title> two column left column fixed, right column width adaptive--aa25. cn</title> <style type= "Text/css" > <!--#left {background-color: #E8F5FE; border:1px solid #A9C9E2; Float:left; height:300px; width:200px; } #right {background-color: #F2FDDB; border:1px solid #A5CF3D; height:300px; --</style> </pead> <body> left column--fixed (AA25. CN) Right Column--width adaptive (AA25. CN) </body> </ptml></textarea>
[Ctrl + A full selection Note: If you need to introduce external JS need to refresh to execute]
The two columns right column width adaptive often in the website in use, injustice is the right column, can also be left column, method is the same, only need to change two div writing can, and this kind of application in the current many blog can often see, such as Pjblog in the template that many users make is this layout.
The production process is no longer detailed here, please refer to the previous tutorial: CSS page layout Getting Started Tutorial 5: Two column width adaptive, simply change the width of the left column to 200px, the right column width and left floating to remove. If you do not understand the place you can ask a question or leave a message in the guestbook.
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.