html - 为三 Angular 形 div 创建阴影

标签 html css

如何为三 Angular 形div创建阴影?这是我正在尝试的代码

HTML

 <div id="triangle-down"></div>

CSS

 #triangle-down {
     width: 0;
     height: 0;
     border-left: 50px solid transparent;
     border-right: 50px solid transparent;
     border-top: 100px solid red;
     box-shadow: 1px 1px 5px #000;
 }

此代码为 div 标签创建方形阴影。现在我们如何为这个 div 标签创建三 Angular 形阴影?

最佳答案

Method 1

HTML

<div class="triangle-with-shadow"></div>

CSS

.triangle-with-shadow {
   width: 100px;
   height: 100px;
   position: relative;
   overflow: hidden;
   box-shadow: 0 16px 10px -17px rgba(0,0,0,0.5);
}
.triangle-with-shadow:after {
   content: "";
   position: absolute;
   width: 50px;
   height: 50px;
   background: #999;
   transform: rotate(45deg);
   top: 75px;
   left: 25px;
   box-shadow: -1px -1px 10px -2px rgba(0,0,0,0.5);
}
.triangle-with-shadow:hover, .triangle-with-shadow:hover:after {
   box-shadow: none;
}



Method 2

HTML

<span class="triangle">▼</span>

CSS

.triangle {
    color:red;
    font-size:100px;
    text-shadow: 0 0px 10px black;
}

关于html - 为三 Angular 形 div 创建阴影,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21122558/

相关文章:

css - app.css 与 app.sass 的合并问题

css - 叠加图形css

html - 向卡片添加过渡

html - CSS |向内的盒子阴影?

javascript - 如何使菜单行响应?

html - Bootstrap 3 嵌套行打破了设计师的网格

css - FXML 引用 CSS 变量

来自网络路径的 CSS 背景图片

javascript - 如何仅将搜索表单添加到商店页面和类别页面?

html - 如何将 CSS 菜单项之间的点转换为线?