qq_40133235 2021-01-12 17:07 采纳率: 50%
浏览 133
已采纳

在css中设置图片的样式:font-size:0;为什么会改动字到图片的距离

<a class="s_c_img" href="">
    <img src="jQuery实战-小米官网的开发_files/2(4).jpg" alt="" width="160px" height="160px">  
</a>
<a class="s_c_title" href="">小米体重秤</a>
<p class="s_c_detail">高精度压力传感器,手机管理全家健康</p>
#smart .s_content ul .s_c_bottom .s_c_img{
    font-size: 0;/* 这是设置了font-size:0;的*/
    text-align: center;
    display: block;
    padding: 20px 35px;
}
#smart .s_content ul .s_c_bottom .s_c_title{
    text-align: center;
    display: block;
    font-size: 14px;
    color: #000;
}
#smart .s_content ul .s_c_bottom .s_c_detail{
    font-size: 12px;
    text-align: center;
    color: #999;
    margin: 5px 0 13px 0;
}

#smart .s_content ul .s_c_bottom .s_c_img{
    /* font-size: 0; */这个是未设置font-size:0;的样式
    text-align: center;
    display: block;
    padding: 20px 35px;
}
#smart .s_content ul .s_c_bottom .s_c_title{
    text-align: center;
    display: block;
    font-size: 14px;
    color: #000;
}
#smart .s_content ul .s_c_bottom .s_c_detail{
    font-size: 12px;
    text-align: center;
    color: #999;
    margin: 5px 0 13px 0;
}

这两者有细微的差别,为什么会有这样的差别?希望大佬可以帮忙告诉下,谢谢!!!

  • 写回答

2条回答 默认 最新

  • 鲤鲤鲤carp 2021-01-12 17:49
    关注

    因为bolck,inline-block中 自带一个空格缝隙,你把它设为font-size:0 ,就把缝隙消除了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用