html - CSS 悬停显示 anchor

标签 html css

因此,我正在尝试重新创建 Facebook Messenger 的齿轮图标,该图标在聊天框对话当前处于事件状态或用户将鼠标悬停在其上时显示。 不太确定如何处理悬停...?

    #gear:before {
        color: black;
        content: "\f43c";
        font-family: "Ionicons";
        display: none;
        float: right;
        padding-right: 10px;
        font-size: 1.2em;
    }

    #list li:hover + #gear:before{
        display: inline-block !important;
    }
    <ul id="list">
       <li class="enter">
           <div class="listContent">
                        
               <a href="#" class="close"></a>
               <span class="name"> Some Name </span>
               <a href="#" id="expand"></a>
               <a href="#" id="gear"></a>

    </div></li></ul>

最佳答案

像这样更改悬停规则#list li:hover #gear:before {

#gear:before {
    color: black;
    content: "ABC";
    font-family: "Ionicons";
    display: none;
    float: right;
    padding-right: 10px;
    font-size: 1.2em;
}

#list li:hover #gear:before {
    display: inline-block;
}
<ul id="list">
  <li class="enter">
    <div class="listContent">

      <a href="#" class="close"></a>
      <span class="name"> Some Name </span>
      <a href="#" id="expand"></a>
      <a href="#" id="gear"></a>

    </div></li></ul>

关于html - CSS 悬停显示 anchor ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37953860/

相关文章:

html - 调整浏览器大小时,一页网站页面会移动

html - 在页面中间创建内容面板

Firefox 闪烁 3D 变换

css - 允许容器不透明但不允许子元素

javascript - jquery datepicker 禁用和自定义 css

html - CodeIgniter + jQuery(ajax) + HTML5 pushstate : How can I make a clean navigation with real URLs?

html - 如果超过 300 个元素,Chrome CSS 样式不适用于下拉列表

javascript - 从加载的 WebView 中获取 HTML 代码

css - div 内的渐进增强

html - iOS WebView 未释放