html - 如何摆脱图像周围的方形边框?

标签 html css image angular

<分区>

我的这张图片是圆形的,但我该如何去掉正方形的边缘/边框?

enter image description here

HTML

<div id="picture">
<input type='file' id="input">
<img [src]="url" id="Image">
<label for="uploadinput" id="uploadlabel">Upload Picture</label>

CSS

#Image {
  background-image: url('http://i.stack.imgur.com/Dj7eP.jpg');
  border-radius: 200px;
  width: 200px;
  height: 200px;
  background-size: 240px;
  display: block;
  margin: 0 auto;
  outline: none;
  border:none;
  border-radius: none; }

最佳答案

没有 src 时出现的细边框是因为 chrome 显示实际上您定义的空间中不存在图像。 (感谢@Patrick Mlr 指出。)

#Image {
  background-image: url('http://i.stack.imgur.com/Dj7eP.jpg');
  border-radius: 200px;
  background-size: 240px;
  display: block;
  margin: 0 auto;
  width:0px;
  height:0px;
  padding: 100px;
  outline: none;
  border-style: none;
  border-radius: none; }
<div id="picture">
<input type='file' id="input">
<img [src]="url" id="Image">
<label for="uploadinput" id="uploadlabel">Upload Picture</label>

关于html - 如何摆脱图像周围的方形边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43369333/

上一篇:html - 如何使 css 运动路径响应?

下一篇:html - 如何对齐彼此下方的两个导航栏?

相关文章:

html - 如何在这里正确实现第 nth-of-type?

javascript - 在 TinyMCE iframe 中加载 jQuery 文件

html - 我的左侧菜单和子菜单在低带宽情况下覆盖了我的整个页面

css - 正文全宽背景图片

android - uri 图像未在 React native ImageView 中呈现

html - 在没有 src URL 的网页中显示图像

jquery - Bootstrap 验证错误消息 CSS

html - 将表格转换为CSS

html - IE 中的 moz-border-radius,moz-box-shadow

php - 在脚本末尾在网站上绘制图像