Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Common problems of CSS and how to solve them

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Today, I would like to share with you the common CSS problems and how to solve the relevant knowledge points, the content is detailed, the logic is clear, I believe most people still know too much about this knowledge, so share this article for your reference, I hope you can get something after reading this article, let's take a look at it.

1. Block the IE predator (also equal to not indicated under IE)

*: lang (zh) select {font:12px! important;} / * Special use of FF * /

Select:empty {font:12px! important;} / * safari visible * /

Here select is the determiner, following changes in the environment. The second sentence is exclusive to the safari dabbler on MAC.

2. Only IE7 recognizes hack

* + html {… }

In private, this HACK can be adopted when the demand is only for IE7.

3. Identify CSS HACK under IE6 and IE6

* html {… }

This central government should pay special attention to the fact that many landowners have written the HACK of IE6. In fact, IE5.x can also recognize this HACK. The other browsers are not recognized.

Html/**/ > body select {. }

This sentence is the same as the call in the previous sentence.

4. Only IE6 does not recognize div hack

Select {display / * IE6 does not recognize * /: none;}

Here, it is mainly through the CSS annotation to gobble up an attribute and value, and the stream is interpreted before the colon.

5. Only IE6 recognition is supported.

.yangshi {_ height:20px;}

Here IE6 is in favor of identifying the "_" short underscore before the CSS attribute.

6. Only IE6 and IE5 are not recognized.

Select/**/ {display / * IE6,IE5 does not recognize * /: none;}

The difference between this and the following sentence is the addition of a CSS expression between the selector and the curly braces.

7. Only IE5 is not recognized

Select/*IE5 does not recognize * / {display:none;}

This sentence is the explanation that the attribute area is removed from the previous sentence. As long as the IE5 does not recognize

8. Box mold planning mode

Selct {width:IE5.x width; voice-family: "\"}\ ""; voice-family:inherit; width: coarse width;}

The cleaning method of the box mold is not handled by! important. Be familiar with this.

9. Clean up the float

Select:after {content: "."; display:block; height:0; clear:both; visibility:hidden;}

In Firefox, when the children are floating, then the height of the parent can not simply cover the whole child, so at this time to use this floating HACK to define the parent, then the problem can be planned.

10. Truncation ellipsis

Select {- oMut _ text _ over _ flow _ rides; text-overflow:ellipsis; white-space:nowrap; overflow:hidden;}

This is a good technical means to cut off the extra part of the pen and ink after going beyond the length and end with an ellipsis. It's just that Firefox doesn't approve of it now.

11. As long as Opera recognizes

@ media all and (min-width: 0px) {select {. }}

Make your own settings for Opera readers.

The above usually write some HACK in CSS, these are used to prepare partial compatibility problems, if you expect to break up the compatibility content, you might as well try the following filters. Some of these filters are written in CSS to import special styles, and some are written in HTML to generally import the necessary patch formats through premise links.

12. If premise Hack of IE

All IE recognizable

As long as the IE5.0 can recognize

Both IE5.0 package and IE5.5 can be identified.

Only IE6 can recognize

IE6 and IE6 can be recognized by the following IE5.x

Only IE7 can recognize

13. IE8 compatible recognition only

Div {height:20px\ 9;}

Only IE8 agrees to identify the "\ 9" here.

These are all the contents of this article entitled "problems in Common CSS and how to solve them". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report