css list inline is not listing items horizontally?

后端 未结 5 1143
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-31 07:13

I don\'t know why this is not displayed right, the list is meant to display horizontally? Instead it is displaying vertically!

this is my code:

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-31 07:43

    That's because the h1 element is block-level element by default.

    Add:

    h1 {display: inline; }
    

    to your css and they work as you want.

    On a separate note, it's worth noting that there should be only one h1 per page, all other headings, semantically, are below that heading and are sub-headings, of a sort. Think of it as a book, the book-title would be the h1, the chapters the h2 and so on.

    I'd suggest, then, changing your html a little:

    
    

    But that might, possibly, be just me =)

    Here's an article to support my point of view:

    • Grok Web-Standards

提交回复
热议问题