html - 我可以将框阴影自定义为图像后面的三 Angular 形吗?

标签 html css

我正在尝试自定义一个框阴影,使其形状像图像后面的三 Angular 形。像这样:

但我不知道是否有办法使用盒子阴影来做到这一点。

到目前为止,这是我的代码。

#image{
      width: 200px;
      box-shadow: -10px 10px  #ff9900;
        }
<img src="https://placeimg.com/200/180/any" id="image" />

最佳答案

一个带有渐变的简单边框就可以做到,而且它会响应:

#image {
  border: 10px solid transparent;
  border-image: linear-gradient(to bottom left, transparent 60%, #ff9900 60.5%) 10;
}
<img src="https://placeimg.com/180/150/any" id="image" />
<img src="https://placeimg.com/250/150/any" id="image" />

几乎相同,但有背景:

.box{
  width:200px;
  height:150px;
  padding:10px; /*control the space*/
  background: 
    url(https://placeimg.com/180/150/any) center/cover content-box,
    linear-gradient(to bottom left, transparent 60%, #ff9900 60.5%);
}
<div class="box"></div> 

关于html - 我可以将框阴影自定义为图像后面的三 Angular 形吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56042216/

相关文章:

html - 如何设置设备最小宽度和缩放较低的宽度

javascript - 在 JavaScript 中以编程方式选择文本

html - 表格单元格中的多个垂直对齐元素

css - NoSuchElementException 使用 RSelenium 抓取 ESPN

html - 让 child 占据与 parent 相同的高度和比例宽度

html - 使用 HTML 对齐和对齐文本

html - 在表格单元格 div 中打断单词

php - 如何将选定的选项值作为文本字段的名称属性传递?

css - 在响应式 CSS 中使用像素宽度

javascript - 如何在顶部滚动表单面板?