gpt4 book ai didi

html - 使用 CSS 增加
  • 标签悬停
  • 转载 作者:太空宇宙 更新时间:2023-11-04 12:15:50 26 4
    gpt4 key购买 nike

    我无法设置我的 <li>标签悬停高度。下面是我的 html 和 css 代码的 jsfiddle。谁能帮我这个。如果有人可以帮助我,我会很高兴。

    My menubar jsfiddle

    下面是我的html代码:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Home</title>
    <link rel="stylesheet" type="text/css" href="style.css">
    </head>

    <body>
    <div id="logo">

    </div>
    <div id="navigation">
    <ul>
    <li id="left"><a href="#home">Home</a></li>
    <li id="left"><a href="#home">About Us</a></li>
    <li id="left"><a href="#home">Events</a></li>
    <li id="left"><a href="#home">Contact Us</a></li>
    <li id="right"><a href="#home">Login</a></li>
    </ul>

    </div>
    <div id="imgbanner">

    </div>
    </body>
    </html>

    这是我的CSS代码:

    #logo {
    border-bottom: 2px solid black;
    width: 100%;
    height: 100px;
    }

    #navigation {
    background-color: #fff;
    border: 1px solid #dedede;
    border-radius: 4px;
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.055);
    color: #888;
    display: block;
    margin: 0;
    overflow: hidden;
    width: 100%;
    }

    #navigation ul {
    list-style-type: none;
    margin: 0;
    padding: 0;

    }

    #navigation li {
    display: inline;
    /*padding: 20px;*/
    -webkit-transition: all 0.2s;
    -moz-transition: all 0.2s;
    -ms-transition: all 0.2s;
    -o-transition: all 0.2s;
    transition: all 0.2s;
    }

    #navigation li:hover {
    background-color: rgb( 251,184,41);
    /* padding: 20px;
    */
    }

    #navigation a {
    color: #026475;
    display: inline-block;
    line-height: 56px;
    padding: 0 24px;
    text-decoration: none;
    }

    /*#imgbanner {
    position: absolute;
    border: 2px solid black;
    }
    */
    ul #right {
    float: right;
    }

    li #right{
    float: left;
    }

    运行此当前代码后,我可以将鼠标悬停在我的 <li> 上标签,但最后一个的高度不同 <li>标签

    最佳答案

    更新 fiddle :http://jsfiddle.net/eve8nsau/1/

    改变

    #navigation li {
    display: inline;
    ...

    进入

    #navigation li {
    display: inline-block;
    ...

    现在,您可能会注意到列表项之间有一个小间隙,但您可以使用各种技术将其删除 already discussed on SO


    预览(在悬停时)

    enter image description here

    关于html - 使用 CSS 增加 <li> 标签悬停,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28721480/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com