How to arrange CSS list horizontally

王林
Release: 2020-11-16 09:29:33
Original
12508 people have browsed it

How to arrange the CSS list horizontally: You can use the [display:inline] attribute to set the [

  • ] tag as an inline element to achieve the horizontal arrangement effect. The display attribute specifies the type of box the element should generate.
  • How to arrange CSS list horizontally

    ##Idea:

    Set the display:inline of the
  • tag, and set
  • as an inline element. Achieve the effect of horizontal arrangement.

    (Recommended tutorial:

    css video tutorial)

    Attribute introduction:

    The display attribute specifies the type of box that the element should generate.

    Specific code:


    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>列表横向排列的另一种方法</title>
    <style type="text/css">
    ul li{display:inline;background:#F93; padding:5px;}}
    </style>
    </head>
    
    <body>
    <ul>
        <li>Item1</li>
        <li>Item2</li>
        <li>Item3</li>
        <li>Item4</li>
    </ul>
    </body>
    </html>
    Copy after login

    Effect:


    How to arrange CSS list horizontally##Problem:

    li between There is a gap

    Solution:

    Write li in one line

    <ul>
        <li>Item1</li><li>Item2</li><li>Item3</li><li>Item4</li>
    </ul>
    Copy after login

    Effect:

    ##Related recommendations:How to arrange CSS list horizontallyCSStutorial

  • The above is the detailed content of How to arrange CSS list horizontally. For more information, please follow other related articles on the PHP Chinese website!

    Related labels:
    source:php.cn
    Statement of this Website
    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
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!