gpt4 book ai didi

html - 在
  • 标签内垂直对齐
  • 转载 作者:太空宇宙 更新时间:2023-11-04 14:16:51 24 4
    gpt4 key购买 nike

    HTML:

    <div id="navbar">
    <div id="container">
    <ul style="height:40px">
    <li><p id="navtext">Home</p></li>
    </ul>
    </div>
    </div>

    CSS:

    ul {
    list-style-type:none;
    margin:0;
    padding:0;
    overflow:hidden;
    }
    li {
    float:left;
    }
    #navtext {
    color:#FFFFFF;
    padding-bottom:-50px;
    }
    #navbar {
    width:100%;
    height:40px;
    background-color:#3498db;
    }
    #container {
    margin-right:15%;
    margin-left:15%;
    vertical-align: middle;
    }

    我希望“主页”文本位于 <ul> 的中心位置标签是 40px 高。我曾尝试四处寻找答案,但似乎没有任何效果。我正在尝试为我的网站制作导航栏。

    最佳答案

    添加你的CSS:

    #container ul li {line-height:10px;}

    http://jsfiddle.net/PWTcL/

    关于html - 在 <li> 标签内垂直对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20289973/

    24 4 0