This article mainly introduces the relevant information about javascript development web pages that are compatible with various browsers. Here are several methods to help you master such functions. Friends in need can refer to
javascript development Web pages are compatible with various browsers
Preface:
It is a commonplace issue that CSS is compatible with various browsers. There are tutorials all over the Internet. The following content There is not much novelty, it is purely a personal summary, I hope it can be of some help to beginners.
1. CSS HACK
The following two methods are almost the same Can solve all today's HACK.
1, !important
With IE7's support for !important, the !important method is now only for IE6's HACK. (Pay attention to the writing. Remember that the declaration position needs to be In advance.)
<style> #wrapper { width: 100px!important; width: 80px; } </style>
2, IE6/IE77 for FireFox
*+html and *html are IE specific tag, firefox does not support it yet. And *+html is a unique tag for IE7.
##
<style> #wrapper { #wrapper { width: 120px; } *html #wrapper { width: 80px;} *+html #wrapper { width: 60px;} } </style>
Note:
*+html 对IE7的HACK 必须保证HTML顶部有如下声明: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2. Universal float closure (very important!)
For the principle of clear float, please refer to [How To Clear Floats Without Structural Markup]<style> .clearfix:after { content:"."; display:block; height:0; clear:both; visibility:hidden; } .clearfix { display:inline-block; } .clearfix {display:block;} </style>
3. Other compatibility tips (again)
1. Setting padding on p under FF will cause the width and height to increase, but IE will not. (Available! important solution)2). Horizontally centered. margin: 0 auto;(Of course it’s not a panacea)
The above is the detailed content of Detailed introduction to web pages developed with JavaScript that are compatible with various browsers. For more information, please follow other related articles on the PHP Chinese website!