In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces an example analysis of the compatibility of CSS browsers, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article.
The compatibility of CSS with readers is sometimes a headache. Maybe when you appreciate the talent and reason in it, it is not difficult to feel it. You have collected the compatibility treatment methods of IE7,6 and Fireofx from the Internet and rectified them. For excessive web2.0, please write code in xhtml pattern as much as possible, and DOCTYPE affects DIV CSS processing. As a W3C standard, be sure to add DOCTYPE declaration.
CSS ability
The vertical center title of 1.div vertical-align:middle; increases the line spacing to a height different from that of the entire DIV line-height:200px; and then inserts calligraphy to center vertically. The flaw is to check the form and not to change the line.
2. Double the title of margin set up the div equipped with float and the margin configured under ie will be more and more. This is a gap that ie6 has. The intention is to add display:inline; to this div, for example:
The css of the response is
# IamFloat {float:left; margin:5px;/*IE is understood as 10px*/ display:inline;/*IE and then 5px*/}
3. Double cut-off of fire in floating ie
# box {float:left; width:100px; margin:0 00 100px; / / in this environment, IE will breed the distance at which 200px occurs, display:inline; / / causes floating to ignore}
Let's talk about block and inline in detail: the personality of block element is that it can always start on a new line, height, width, line height and margin can be controlled (block element); the nature of Inline element is that it is on the same line as other elements and can not be restrained (embedded element); # box {display:block; / / can be considered to emulate the effectiveness of block element display:inline; / / to complete the same line diplay:table.
4 the problem of IE and width and height IE does not recognize the definition of min-, but in fact it treats malformed width and height as if there is a min. In this way, the title is big, if only width and height are used, these two values will not change in the deformed browser. If only min-width and min-height are used, the bottom of IE is equal to no width and height. For example, to set up the equipment to back up the picture, this width is critical. To plan this title problem, you can go like this: # box {width: 80px; height: 35px;} html > body # box {width: auto; height: auto; min-width: 80px; min-height: 35px;}
5. The minimum width of the page min-width is a very convenient CSS edict, it can specify that the element can not be less than a certain width, so as to ensure that typesetting is constantly accurate. But IE doesn't recognize this, and it actually uses width as the minimum width. To make this call available on IE, you can put one under the tag and specify a class for div later, and how CSS is designed from now on: # container {min-width: 600px; width:_expression (document.body.clientWidth
< 600? "600px": "auto" );} 第一个min-width是正常的;但第2行的width使用了Javascript,这只需IE才认得,这也会让你的HTML文档不太正规。它实际上通过Javascript的判断来实现最小宽度。 6.DIV浮动IE文本孕育发生3象素的裂痕 左边对象浮动,左边接纳外补丁的左边距来定位,左侧对象内的文本会离左边有3px的间距. CSS代码: #box{ float:left; width:800px;} #left{ float:left; width:50%;} #right{ width:50%;} *html #left{ margin-right:-3px; //这句是要害} HTML代码: 7.IE捉迷藏的问题 当div运用冗杂的时刻每个栏中又有一些链接,DIV等这个时刻容易发生捉迷藏的问题。 有些内容透露表现不进去,当鼠标决议这个周边是发现内容确确凿页面。 筹划方式:对#layout使用line-height属性 或者给#layout使用固定高和宽。页面构造尽量容易。 8.float的div闭合;断根浮动;自顺应高度; ① 例如: 这里的NOTfloatC并不盼望继续平移,而是企望往下排。(其中floatA、floatB的属性也曾设置装备摆设为 float:left;) 这段代码在IE中毫无标题,标题出在FF。启事是NOTfloatC并不是float标签,必需将float标签闭合。 在 之间加之 < #div class="clear">This div must pay attention to identity, and must be at the same level as two div with float attributes, and there must be no nested relationship between them, otherwise it will happen incomparably. And the style of clear can be defined as as follows:
.clear {clear:both;}
② as the div of the external wrapper, do not fix the height. In order to allow the height to be passively adapted, add overflow:hidden; to the wrapper. When collecting float's box, highly active adaptation is useful under IE. At this time, the layout private attribute of IE should be triggered (evil IE!) This can be done with zoom:1;, so compatibility is achieved. For example, a wrapper has the following definition:
.colwrapper {overflow:hidden; zoom:1; margin:5px auto;}
③ for typesetting, our most frequently used css drawing may be equal to float:left. There are times when we need to be a rival backup on the reverse side of the float div in column n, such as:
For example, we want to configure the background of page to blue, so that the backup tone of all three columns is blue index, but we will find that with the downward growth of left center right, while page is highly stubborn in life, the problem arises, the reason is that page is not a float attribute, and our page cannot be set to float because it has to be centered, so we should deal with it like this.
Embed another float left with a width of 100% DIV governance
④ omnipotent float closure (quite critical!) For more information about clear float, please see [How To Clear Floats Without Structural Markup]. Insert the following code into Global CSS and add class= "clearfix" to the div that needs to be closed.
/ * Clear Fix * / .clearfix: after {content: "."; display:block; height:0; clear:both; visibility:hidden;} .clearfix {display:inline-block;} / * Hide from IE Mac * / .clearfix {display:block;} / * End hide from IE Mac * / / * end of clearfix * /
Or how to configure:
.hackbox {display:table; / / display the object as a table at the block element level}
11. Height incompatibility means that the outer height cannot be actively adjusted when the height of the inner object changes, especially when the inner object uses margin or paddign.
Example:
# box {bac kilogram round-color:#eee;}
# box p {margin-top: 20pxwitting: Margaret Murbottom: 20px; text-align:center;}
Schema in p object
Handling method: add 2 empty div object CSS codes above and below the P object:
{height:0px;overflow:hidden;} or add the border attribute to DIV.
12. There are many ways to plan this BUG under IE6, such as tampering with the layout of html, configuring img to display:block or configuring vertical-align attribute to vertical-align:top | bottom | middle | text-bottom.
13. How to align text with text output boxes plus
Vertical-align:middle
14. Is there any difference between id and class defined in the site standard? Repeated ID is not allowed in the site specification, for example, div id= "aa" is not allowed to repeat twice, while class refers to classes, which can actually be repeated endlessly, so that definitions that need to be invoked many times can be used. two。 The priority of the attribute title ID takes precedence over class, see example 3 below. To facilitate client scripts such as JS, if you want to coax an object in the page, you can define an ID for him, otherwise you can only find it by traversing the page elements and specifying specific attributes, which is relatively wasted life capital and is not as easy as an ID.
15. The method of ellipsis when the form exceeds the length in LI. This method is practical with IE and OP readers.
16. Why can't IE set the color of the rotation bar on the site scale? the management method is to replace body with html.
17. Why it is impossible to define the container with 1px dominating height under IE6 this topic is made up of default row heights. There are many ways to do this, for example: overflow:hidden | zoom:0.08 | line-height:1px
18. How can we make the layer perform above the FLASH? the designed door path is to set up equipment and equipment for the FLASH.
19. How to center a layer vertically in the trapper, here we use the method of absolute positioning of the percentage and pinning the negative value, the size of the negative value is its own width and height divided by two.
Thank you for reading this article carefully. I hope the article "sample Analysis of CSS browser compatibility issues" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.