Get the App
SLTechnology News&Howtos  ›  Development  › 

How to solve the problem of CSSHack and float closure

Shulou Source: shulou.com Published: 2022-06-03 14:21:07 10月01日 Update

This article mainly explains "how to solve the problem of CSSHack and float closure". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to solve the problem of CSSHack and float closure.

CSS skills: about CSSHack and float closure

1. CSSHACK

The following two methods can solve almost all HACK.

1,!important

With IE7's support for! important, the! important method is now only targeted at IE6's HACK. Pay attention to the way you write. Remember that the location of the declaration needs to be advanced.)

ExampleSourceCode

# wrapper {width 100pximportant; width:80px;}

2jigme IE6max IE7 pair of FireFox

* + html and * html are IE-specific tags, which are not supported by firefox. And * + html is a unique tag for IE7.

ExampleSourceCode

# wrapper {# wrapper {width:120px;} * html#wrapper {width:80px;} * + html#wrapper {width:60px;}}

Note:

* + html must ensure that the HACK of IE7 has the following declaration at the top of HTML:

2. Float closure (clear float)

Add the following code to the GlobalCSS and add class= "clearfix" to the div that needs to be closed.

ExampleSourceCode

Clearfix: after {content: "."; display:block; height:0; clear:both; visibility:hidden;} .clearfix {display:inline-block;} .clearfix {display:block;} so far, I believe you have a better understanding of "how to solve the problem of CSSHack and float closure". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Closure problems methods content tags learning support practicality depth trial and error code location interest writing oneness practicality practicality skill ease of operation more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB macOS Shulou Information OPPO Reno Xiaomi