Heim  >  Fragen und Antworten  >  Hauptteil

javascript – So erzielen Sie den Effekt, dass beim Bewegen der Maus ein roter Rand angezeigt wird

Wer hat diesen Effekt gemacht? Das habe ich mit border-right:1px solid #eee;border-bottom:1px solid #eee; geschrieben. Wenn die Maus schwebt, soll links auch ein pixelroter Rahmen vorhanden sein

过去多啦不再A梦过去多啦不再A梦2663 Tage vor1215

Antworte allen(8)Ich werde antworten

  • 淡淡烟草味

    淡淡烟草味2017-07-05 11:06:45

    看起来好像每个项题主都只有右边跟下边?

    我感觉改成每个项都有左边跟下边,hover的时候再通过设置相邻元素的左边颜色如何?

    示例:

    *{
        box-sizing:border-box;
    }
    .wrap{
        width:300px;
        
    }
    .item{
        width:75px;
        float:left;
        text-align:center;
        border:1px solid #eee;
        border-right-width:0;
    }
    .item:last-child{
        border-right-width:1px;
    }
    
    .item:hover{
        border-left-color:red;
        border-bottom-color:yellow;
    }
    .item:hover + .item{
        border-left:1px solid yellow;
    }
    .item:last-child:hover{
        border-right:1px solid yellow;
    }
    <p class="wrap">
        <p class="item">
            hello
        </p>
        <p class="item">
            hello
        </p>
        <p class="item">
            hello
        </p>
        <p class="item">
            hello
        </p>
    </p>

    http://runjs.cn/detail/ibxy9qab

    Antwort
    0
  • 仅有的幸福

    仅有的幸福2017-07-05 11:06:45

    ul li:hover{
      border: 1px solid #ed9639;
    }

    Antwort
    0
  • 学习ing

    学习ing2017-07-05 11:06:45

    box-shadow

    Antwort
    0
  • 欧阳克

    欧阳克2017-07-05 11:06:45

    是不是被左边的li挡住了的?最左边的有红边么?

    Antwort
    0
  • 習慣沉默

    習慣沉默2017-07-05 11:06:45

    border-left不行吗?

    Antwort
    0
  • 扔个三星炸死你

    扔个三星炸死你2017-07-05 11:06:45

    是不是你的选择器 权值太小被覆盖了

    Antwort
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-07-05 11:06:45

    hover 的时候 要设置z-index。高于其它层级,这样你的边框才不会被覆盖

    Antwort
    0
  • 伊谢尔伦

    伊谢尔伦2017-07-05 11:06:45

    感谢大家的回答,我已经找到解决办法,分享给大家
    http://www.jb51.net/css/14548...

    Antwort
    0
  • StornierenAntwort