简体   繁体   English

根据路线更改页脚背景颜色 Angular

[英]Change footer background color depending on route Angular

I have a wavy footer which acts as a block, the problem is that because of that, the transparent part of the wave (the space which color should be the same as the route background) is white since it's occupying space as a block.我有一个作为块的波浪页脚,问题是正因为如此,波浪的透明部分(颜色应该与路线背景相同的空间)是白色的,因为它作为块占用空间。

1 1

2 2

3 3

Here's the css:这是 css:

.wave{
   background: rgba(255, 255, 255, 0);
   height: 15px;
   position: relative;
 }

 .wave::before, .wave::after{
   border-bottom: 5px solid #69c0c0;
 }

 .wave::before{
   content: "";
   position: absolute;
   left: 0;
   right: 0;
   bottom: 0;
   height: 10px;
   background-size: 20px 40px;
   background-image:
   radial-gradient(circle at 10px -15px, transparent 20px, #69c0c0 21px);
 }

 .wave::after{
   content: "";
   position: absolute;
   left: 0;
   right: 0;
   bottom: 0;
   height: 15px;
   background-size: 40px 40px;
   background-image:
   radial-gradient(circle at 10px 26px, #69c0c0 20px, transparent 21px);
 }

How could I change it in order to still act as a block, but change it's background color depending on the color of the route it's on?我怎么能改变它以仍然充当一个块,但根据它所在路线的颜色来改变它的背景颜色?

The quickest way I would come around this is by adding the top property to both pseudo-elements, setting their values to negative height, and changing .wave 's background.解决这个问题的最快方法是将top属性添加到两个伪元素,将它们的值设置为负高度,并更改.wave的背景。

Updated CSS更新了 CSS

.wave{
   background: #69c0c0;
   height: 15px;
   position: relative;
 }

 .wave::before, .wave::after{
   border-bottom: 5px solid #69c0c0;
 }

 .wave::before{
   content: "";
   position: absolute;
   left: 0;
   right: 0;
   bottom: 0;
   top: -10px;
   height: 10px;
   background-size: 20px 40px;
   background-image:
   radial-gradient(circle at 10px -15px, transparent 20px, #69c0c0 21px);
 }

 .wave::after{
   content: "";
   position: absolute;
   left: 0;
   right: 0;
   bottom: 0;
   top: -15px;
   height: 15px;
   background-size: 40px 40px;
   background-image:
   radial-gradient(circle at 10px 26px, #69c0c0 20px, transparent 21px);
 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM