I haven't cut the graph for a long time. Yesterday I encountered an old browser compatibility problem. In IE7, after the parent element is set to float, its width is adaptive, if the width of the child element is not determined, the minimum width is displayed, that is, the width of the text.
Other normal browsers are shown as follows:
IE7 displays the following results:
Solution:
1. Add a fixed width to the parent element;
If method 1 violates the desired effect, it can only be processed using JS, that is, obtain the UL width of the same level node of H4, and then assign it to h4.
As follows:
<SCRIPT>
Window. onload = function (){
If (navigator. appname = "Microsoft Internet Explorer" & navigator. appversion. split (";") [1]. replace (/[]/g, "") = "msie7.0 "){
For (VAR I = 0; I <3; I ++ ){
Document. getelementbyid ('H _ '+ I). style. width = Document. getelementbyid ('U _' + I). offsetwidth + 'px ';
}
}
}
</SCRIPT>
First Judge IE7, and then run this code for IE7. You can also use JQ to achieve the same principle.
If the width of the parent element of IE7 is adaptive and floating, the width of the child element cannot be set proportionally.