Introduction to CSS page layouts 2: A list of adaptive width _ Basics Tutorials

Source: Internet
Author: User
Adaptive layout is a common form of web page design, adaptive layout can be based on the size of the browser window, automatically change its width and height values, is a very flexible layout, a good adaptive layout site for different resolution of the display can provide the best display effect. In fact, the div default state occupies the entire line of space, is the width of 100% adaptive layout of the expression, a list of adaptive layout needs to do the work is also very simple, just want to change the width from a fixed value to the form of a percentage value.
Copy Code code as follows:

#layout {
border:2px solid #A9C9E2;
Background-color: #E8F5FE;
height:200px;
width:80%;
}

CSS in most of the value as a parameter of the style properties are provided, width width of the property is no exception, where we will be width from a column fixed width of 300px, to 80%, from the bottom of the preview effect can be seen, the width of the DIV has become the browser width of 80% of the value. The adaptive advantage is that when you enlarge or shrink the browser window, its width will also remain in proportion to the current width of the browser.
<! 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>aa25. Cn_ a list of adaptive widths </title> <style type= "Text/css" > <!--#layout {border:2px solid #A9C9E2; Background-color: #E8F5FE; height:200px; width:80%; }--> </style> </pead> <body> <div id= "Layout" > a list of adaptive widths (AA25. CN) </div> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Used only when setting the width from the original 300px, to 80%.

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.