IE6 implement min-width_HTML/Xhtml _ web page creation

Source: Internet
Author: User
First, we know that this effect should be an old topic. Today, when I sorted out files, I found that some of my previous layout solutions were lying in folders for a long time, it should be noted that we have the honor to have seen the implementation of this effect by CSSPLAY's old engineer webmaster, and it must have been provided very early. Let's talk less about the source code: The first thing we know is that this effect should be an old topic.
Today, when I sorted out files, I found that some of my previous layout solutions had been lying in folders for a long time.
It should be noted that we were lucky to have also seen the implementation of this effect by CSSPLAY's old engineer webmaster, and it must have been provided very early.
Let's talk less about the source code:
Trigger and take advantage of the weird characteristics of the IE6-layout, css implementation:



In ie6, the container simulates the min-width effect. Change the browser window size and click "view width ".




Css implementation Demonstration:
Run code box
<Html xmlns = "http://www.w3.org/1999/xhtml"> <pead> <meta http-equiv = "Content-Type" content = "text/html; charset = gb2312 "/> <title> Minimum CSS width </title> <style type =" text/css "> body {text-align: center ;}. the ie6-out {_ margin-left: 900px; _ zoom: 1 ;}. the ie6-in {_ position: relative; _ float: left; _ margin-left:-900px;} # min-width {min-width: 900px; background: # ccc; line-height: 200px; _ zoom: 1 ;}</style> </pead> <body> <p class = "ie6-out"> <p Class = "ie6-in"> <p id = "min-width"> ie6-lower, the container simulates the min-width effect. Change the browser window size and click "view width ". </P> <input name = "" type = "button" onclick = "alert ('container width = 'document. getElementById ('min-width '). clientWidth 'pxy' \ n \ n'''viewwidth = '(document.doc umentElement. clientWidth | document. body. clientWidth) 'px '); "value =" view width "/> </body> </ptml>
[Ctrl A select all prompt: you can modify some code first and then press run]
Extension Demonstration:
Run code box
<Html xmlns = "http://www.w3.org/1999/xhtml"> <pead> <meta http-equiv = "Content-Type" content = "text/html; charset = gb2312 "/> <title> Minimum CSS width </title> <style type =" text/css "> body {text-align: center ;}. the ie6-out {_ margin-left: 900px; _ zoom: 1 ;}. the ie6-in {_ position: relative; _ float: left; _ margin-left:-900px; background: # f00; line-height: 200px ;} # min-width {min-width: 900px; background: # ccc; _ zoom: 1 ;}</style> </pead> <body> <p linoleic Ss = "ie6-out"> <p class = "ie6-in"> aa </p> <p class = "ie6-out"> <p class = "ie6-in"> aa <p id = "min-width"> ie6-bottom, the container simulates the min-width effect. Change the browser window size and click "view width ". </P> <input name = "" type = "button" onclick = "alert ('container width = 'document. getElementById ('min-width '). clientWidth 'pxy' \ n \ n'''viewwidth = '(document.doc umentElement. clientWidth | document. body. clientWidth) 'px '); "value =" view width "/> </body> </ptml>
[Ctrl A select all prompt: you can modify some code first and then press run]
CSS Expression
-- I believe that many people will often be troubled by inexplicable crashes when using this method to achieve the minimum width of the container. In the end, there is always no result.
Here, we need to point out two points:
1. IE6-in standard mode and quirk mode, elements representing the view are different. The former isThe latter is;
2. IE6-in the two different modes above, it has different manifestations of content overflow, resulting in an endless loop of value assignment judgment. It can be explained as a little cool. Please do it yourself.
CSS Expression minimum width source code:

In ie6, the container simulates the min-width effect. Change the browser window size and click "view width ".


Demo:
Run code box
<! 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> CSS Expression minimum width </title> <style type =" text/css "> body {text-align: center ;} # min-width {min-width: 900px; _ width: expression((document.doc umentElement. clientWid Th | document. body. clientWidth) <900? "900px": ""); line-height: 200px; background: # ccc; _ zoom:/* to view clientWidth, you can omit */} </style> </pead> <body> <p id = "min-width"> ie6-to simulate the min-width effect. Change the browser window size and click "view width ". </P> <input name = "" type = "button" onClick = "alert ('container width = 'document. getElementById ('min-width '). clientWidth 'pxy' \ n \ n'''viewwidth = '(document.doc umentElement. clientWidth | document. body. clientWidth) 'px '); "value =" view width "/> </body> </ptml>
[Ctrl A select all prompt: you can modify some code first and then press run]
Both the preceding two solutions can be implemented in standard IE6-mode and quirk mode. No CPU efficiency problem is found in IE Expression.

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.