Home  >  Article  >  Web Front-end  >  UL LI cannot be centered, please give me some advice_html/css_WEB-ITnose

UL LI cannot be centered, please give me some advice_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:08:201182browse



无标题页






value=/wEPDwUJMzE4MTEyMzk4ZGR780OmRKbhsSWm41jFhg+gCRDz3g== type=hidden
name=__VIEWSTATE> 



  
  
    

      

class=STYLE2>XX区坏境VOC污染源在线监控平台(企业同步比) 
      



  
  
    

      

            

  •         
    72.08%

            
    AAAAA

  •         

  •         
    5.07%

            
    BBBBB

  •         

  •         
    0%

            
    CCCCC

  •         

  •         
    3.12%

            
    DDDDD

  •         

  •         
    35.35%

            
    EEEEE

  •         

  •         
    0.97%

            
    FFFFF

  • ;


This is the whole code. The problem is that UL LI cannot be centered. Please tell me how to correct it so that it can be centered. Thank you in advance.


Reply to the discussion (solution)
Try setting the width of ul or body using numbers

UL {

TEXT-ALIGN: center; PADDING-BOTTOM: 0px; LIST-STYLE-TYPE: none; MARGIN : 0px auto; PADDING-LEFT: 0px; WIDTH: 700px; PADDING-RIGHT: 0px; PADDING-TOP: 0px

}

LI {
TEXT-ALIGN: center; MARGIN: 5px; WIDTH: 90px ; BACKGROUND: #333366; FLOAT: left; COLOR: #ffffff
}

Centered. . . (IE9)

It’s centered. . . (IE9)

Wrong. . Sorry

Quoting the reply from zsx841021 on the 3rd floor:

It’s in the middle. . . (IE9)


Wrong. . Sorry

What should I do? I don’t know what went wrong

UL {
TEXT-ALIGN: center; PADDING-BOTTOM: 0px; LIST-STYLE-TYPE: none; MARGIN: 0px auto; PADDING-LEFT: 0px; WIDTH: 700px; PADDING-RIGHT: 0px; PADDING-TOP: 0px

}

LI {
TEXT-ALIGN: center; MARGIN: 5px;……

This doesn’t seem to work. . .

float:left; I think this is the cause. . When you change it to right; it's on the right again. .

Quoting the reply from acesidonu on the 2nd floor:

UL {

TEXT-ALIGN: center; PADDING-BOTTOM: 0px; LIST-STYLE-TYPE: none; MARGIN: 0px auto; PADDING-LEFT: 0px; WIDTH: 700px; PADDING-RIGHT: 0px; PADDING-TOP: 0px

}
LI {
TEXT-ALIG……
ie 7 8
ff 10 can all be centered

Quoting the reply from xwy5354 on the 6th floor:
Quoting the reply from acesidonu on the 2nd floor:

UL {

TEXT-ALIGN: center; PADDING-BOTTOM: 0px; LIST-STYLE-TYPE: none; MARGIN : 0px auto; PADDING-LEFT: 0px; WIDTH: 700px; PADDING-RIGHT: 0px; PADDING-TOP: 0……
ie9 will not work. .

IE9 is too advanced and I have never used it.

Quoting the reply from xwy5354 on the 6th floor:

Quoting the reply from acesidonu on the 2nd floor:

UL {

TEXT-ALIGN: center; PADDING-BOTTOM: 0px; LIST-STYLE-TYPE: none ; MARGIN: 0px auto; PADDING-LEFT: 0px; WIDTH: 700px; PADDING-RIGHT: 0px; PADDING-TOP: 0p...
It can be centered in I7 and I8 environments, but it changed my original layout

margin: 5px
Add each 13%

Can it reach 100%?

There is a problem with your calculation
In the end, it is easier to calculate the fixed value
Both As for the percentage, you can calculate it yourself.

I still think the width needs to be centered. .

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