Right-align elements on multiple rows

前端 未结 1 1891
挽巷
挽巷 2021-01-25 00:50

I want to align the li elements to the right side of the div. I am able to do this by floating the ul to the right.

However, I have a lot

1条回答
  •  天命终不由人
    2021-01-25 01:22

    How about a simple text-align: right?

    .row {
      display: flex;
    }
    
    .col-1 {
      flex: 1;
      border: 1px solid red;
    }
    
    .col-2 {
      flex: 1;
      border: 1px solid blue;
    }
    
    ul#menu {
      text-align: right;
      margin: 0;
      padding: 0;  
    }
    
    ul#menu li {
      display: inline;
    }
    Lorem ipsum dolor sit amet

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