Home >Web Front-end >CSS Tutorial >How to solve overflow:auto invalid method in ie7

How to solve overflow:auto invalid method in ie7

不言
不言Original
2018-06-25 16:10:352859browse

This article mainly introduces how to solve the overflow:auto invalid method in ie7. It has certain reference value. Now I share it with everyone. Friends in need can refer to it

Cause
When the style of the direct child element or subordinate child element of the parent element has the position:relative attribute, the overflow:auto of the parent element The properties will become invalid.

Solution
It is very simple to solve this bug. Use position:relative; in the parent element to solve the bug.

Code bug recurrence

<ul>
<li>我是很努力的前端博客,希望你会喜欢</li>
<li>我是很努力的前端博客,希望你会喜欢</li>
<li>我是很努力的前端博客,希望你会喜欢</li>
<li>我是很努力的前端博客,希望你会喜欢</li>
<li>我是很努力的前端博客,希望你会喜欢</li>
</ul>
ul{overflow:auto; height:100px;}
li{position:relative; height:30px; line-height:30px;}

There will be a strange bug in ie7, a scroll bar appears, but the scroll cannot be pulled strip. The solution is to ul{position:relative;}

IE7 float:right will wrap
I thought it would only appear in ie6 , I didn’t expect that IE7 also has this bug. Many people on the Internet said that the element of float:right should be placed at the front. This is such a bad idea. Sacrifice the position of an element to solve this bug. Sometimes you are a little speechless when you look at the code. The solution is to add a relative positioning to the parent layer, and then add an absolute positioning to the right side to achieve . I think this is more reliable.

The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

About CSS writing standard order and naming rules

The above is the detailed content of How to solve overflow:auto invalid method in ie7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn