dou426098 2015-07-03 21:56
浏览 30
已采纳

我的链接图片有不可见的像素,我想通过编码删除[关闭]

My image link has "invisible pixels" that show up as a link when you hover above the actual image. Is there any way to remove them? Here is my code:

<div id="sidebar">
    <div id="navbuttonbox">

        <a href="Movies.php"><img src="img/test.png"/></a>

    </div>
</div><!--sidebar-->

For the style I use

#navbuttonbox {
    margin-left: 37px;
}

So that It will be right where I want it.

I demonstrated it on JSFIDDLE https://jsfiddle.net/1g2pqwy2/1/

When you move your mouse a little bit above the image you still get a cursor link because the tail of the image is higher then the body.

  • 写回答

1条回答 默认 最新

  • dongmu1914 2015-07-03 22:19
    关注

    First here is your HTML.

    <div id="sidebar">
        <div id="navbuttonbox">
            <a href="Movies.php"><img src="img/test.png"></a>
        </div>
    </div>
    

    Try this:

    HTML

    <div id="sidebar">
        <div class="navbuttonbox">
        <a href="Movies.php">Movies</a>
        </div>
        <div class="navbuttonbox">
        <a href="OTHER.PHP">OTHER</a>
        </div> <!--- KEEP REPEATING FOR EACH MENU ITEM //-->
    </div>
    

    CSS

    .navbuttonbox {
      position:relative;
      background: url(/img/test.png);
      background-repeat: no-repeat;
      min-height: 40px;
      padding-top: 10px;
      margin-right: -38px;
    }
    
    .navbuttonbox > a {
      display:block;
      padding:10px;
    }
    

    You'll notice the link is shifted down for those invisible pixels. The tail can be fixed too if you need it with:

    .navbuttonbox > a:before {
      content:'';
      width:38px;
      top:-10px;
      bottom:0;
      right:0;
      position:absolute;
    }
    

    To demonstrate I set up a JSFiddle: here

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c