大佬教程收集整理的这篇文章主要介绍了html – css“background-image”显示不需要的边框,img“src”没有,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
当我使用以下方式渲染图像时:
<img class="img-rounded" id="logo" />
在CSS中:
#logo { background-image: url(/Content/Images/logo.png); }
图像显示为窄边框:
即使我找不到与此效果有关的任何东西.角落是开放的,因为img-round类.
使用以下方法渲染图像:
<img class="img-rounded" id="logo" src="~/Content/Images/SO.png" />
按预期渲染:
我该怎样摆脱边界?
CSS代码我尝试过没有成功:
> border:none;
>颜色:蓝色;
>背景颜色:蓝色;
> border-style:none;
我早些时候在SO上遇到过这个问题,但我不记得那个问题的链接了.
1)使你的身高和宽度为0.
2)根据图像大小给出适当的填充. (即填充:宽度/ 2px高度/ 2px宽度/ 2px高度/ 2px)
简而言之,左右填充应该加到图像的宽度
和
您的顶部和底部填充应添加到图像的高度.
img { background: url(http://i.stack.imgur.com/8C4wK.png) no-repeat; font-size:0; width:0px; height:0px; padding:36px 99px 36px 99px; /* Since height and width are 0. use appropriate padding. Image is of 197 X 73 dimension. So using 36px on left and right whereas 99px each on top and bottom*/ border-style:none; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/> <img />
以上是大佬教程为你收集整理的html – css“background-image”显示不需要的边框,img“src”没有全部内容,希望文章能够帮你解决html – css“background-image”显示不需要的边框,img“src”没有所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。