html - css在边缘淡出盒子阴影
问题描述
对于学校,我需要制作一个网站的精确复制品,我卡在我需要(我认为)添加框阴影的部分,但阴影在边缘逐渐消失,我自己不知道如何做到这一点,所以有谁知道如何做到这一点?
我有一个文本字段,顶部和底部有一条边框线/阴影,它在边缘淡出。
这就是我需要复制的
我的CSS代码:
#ReaderSlideshow{
display: flex;
justify-content: space-around;
margin-top: 50px;
border-bottom: 1px solid black;
border-top: 1px solid black;
}
我的html:
<div id="ReaderSlideshow">
<img src="img/Backarrow.png" alt="Backarrow" width="22px">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.<br> Lorem Ipsum has been the industry's standard dummy text. </p>
<img src="img/forwardarrow.png" alt="forwardarrow" width="22px">
</div>
解决方案
您需要做的就是向您的 DOM 添加一个包装器div,然后对其实现径向渐变。
注意:在您的评论中,您说不能在边框上实现渐变;仅作记录,这不是边框,而是在 div 的顶部和底部实现的 box-shadow。
.wrapper {
width: 100%;
height: content;
padding: 20px 0;
overflow: hidden;
margin: 0;
background: radial-gradient(circle, rgba(231,232,234,0.896796218487395) 0%, rgba(174,175,177,1) 100%); /* this line does the trick */
}
#ReaderSlideshow{
display: flex;
justify-content: space-around;
box-shadow: 0px 1px 5px #aeafb1, 0px -1px 5px #aeafb1;
}
<div class="wrapper">
<div id="ReaderSlideshow">
<img src="img/Backarrow.png" alt="Backarrow" width="22px">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.<br> Lorem Ipsum has been the industry's standard dummy text. </p>
<img src="img/forwardarrow.png" alt="forwardarrow" width="22px">
</div>
</div>
在这里你可以找到关于CSS Radial Gradient的一个很好的解释。
这是一个盒子阴影教程。
推荐阅读
- python - 使用 asyncio 异步运行两个并发任务组
- node.js - 检测电子中节点环境的方法
- java - File.delete() 仅随机删除目标文件
- php - 如何处理运行需要 5 - 10 分钟的脚本?
- docusignapi - DocuSign API - 在日期范围内列出状态更改为“已完成”的信封
- javascript - 如何使用javascript分隔数字?
- java - msf4j 响应图像得到了不正确的关闭变量
- c# - ASP.NET MVC 5 不更新表行并发送详细信息(带有数据表)
- git - 具有大量图像的机器学习数据集的版本控制?
- laravel-5 - 使用 Carbon 我得到“找不到文本月份”错误