html - css 淡出边缘的框阴影

标签 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>

this is how it is supposed to look like This is what i made

最佳答案

您需要做的就是向 DOM 添加一个 wrapper div,然后为其实现一个 radial-gradient

注意:在您的评论中您说无法在边框上实现渐变;郑重声明一下,这不是边框,而是在 div 顶部和底部实现的框阴影。

.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>

Here您可以在 CSS Radial Gradient 上找到很好的解释。

Here是一个盒子阴影教程。

关于html - css 淡出边缘的框阴影,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58783622/

相关文章:

html - CSS - 无法在 div 内将图像和文本对齐在一起

html - 自动调整 Angular 框的大小

javascript - 如何在 Wordpress Fancybox 图像上将文本超链接到外部网站

css - 如何简化这个 LESS CSS Box-shadow mixin? (带有 "directions"的多个阴影)

css - 在 React 中导入 CSS 文件 - Webpack/内联样式

html - 需要div排列如截图所示

javascript - item.appendChild 不是函数

HTML:将跨度文本与图像水平对齐

css - rails 4 : Bootstrap-sass and glyphicons

用于褪色文本背景的 CSS