CSS text-align: center; is not centering things

前端 未结 7 1461
旧巷少年郎
旧巷少年郎 2021-02-03 17:35

I have the following html:


                      
相关标签:
7条回答
  • 2021-02-03 17:59

    If you want the text within the list items to be centred, try:

    ul#menu-utility-navigation {
      width: 100%;
    }
    
    ul#menu-utility-navigation li {
      text-align: center;
    }
    
    0 讨论(0)
  • 2021-02-03 18:01

    I don't Know you use any Bootstrap version but the useful helper class for centering and block an element in center it is .center-block because this class contain margin and display CSS properties but the .text-center class only contain the text-align property

    Bootstrap Helper Class center-block

    0 讨论(0)
  • 2021-02-03 18:03

    To make a inline-block element align center horizontally in its parent, add text-align:center to its parent.

    0 讨论(0)
  • 2021-02-03 18:05

    Use display: block; margin: auto; it will center the div

    0 讨论(0)
  • 2021-02-03 18:13

    You can use flex-grow: 1. The default value is 0 and it will cause the text-align: center looks like left.

    https://css-tricks.com/almanac/properties/f/flex-grow/

    0 讨论(0)
  • 2021-02-03 18:14

    This worked for me :

      e.Row.Cells["cell no "].HorizontalAlign = HorizontalAlign.Center;
    

    But 'css text-align = center ' didn't worked for me

    hope it will help you

    0 讨论(0)
提交回复
热议问题