How do I render
  • side-by-side?
  • 后端 未结 8 655
    情话喂你
    情话喂你 2020-12-29 02:30

    I\'m looking to create a navigation menu with list items rendered in one line. How do I do this?

    8条回答
    •  無奈伤痛
      2020-12-29 03:03

      li {
          display: inline;
      }
      

      EDIT: I now realize why I felt strange answering with display: inline: because I usually use float: left myself instead, which is anthony-arnold's answer (so to him goes my upvote!).

      Anyway, while either method will cause your lis to display in one line, inline elements and floated elements do behave differently. Depending on how you've styled your layout, you may have to choose one or the other.

    提交回复
    热议问题