search

Home  >  Q&A  >  body text

javascript - How to achieve the effect of displaying a red border on mouse hover

Who has done this effect?
This is what I wrote, using border-right:1px solid #eee;border-bottom:1px solid #eee; when the mouse is hovering ul li:hover{border-color:# ed9639;}How to make a pixel red frame on the left side

过去多啦不再A梦过去多啦不再A梦2758 days ago1298

reply all(8)I'll reply

  • 淡淡烟草味

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

    It seems like each item title has only the right and bottom?

    I think it would be better to change each item to have a left side and a bottom side. How about setting the left side color of adjacent elements when hovering?

    Example:

    *{
        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

    reply
    0
  • 仅有的幸福

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

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

    reply
    0
  • 学习ing

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

    box-shadow

    reply
    0
  • 欧阳克

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

    Is it blocked by the li on the left? Does the one on the far left have a red edge?

    reply
    0
  • 習慣沉默

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

    Border-left doesn’t work?

    reply
    0
  • 扔个三星炸死你

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

    Is it because the weight of your selector is too small and is overwritten?

    reply
    0
  • 过去多啦不再A梦

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

    When hovering, z-index needs to be set. Higher than other levels so that your borders are not covered

    reply
    0
  • 伊谢尔伦

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

    Thank you for your answers, I have found a solution and share it with you
    http://www.jb51.net/css/14548...

    reply
    0
  • Cancelreply