Reputation: 2870
I need to understand this alignment! I have done a lot of search for this problem, but still unclear.
Please take a look at this pattern :
For generating this with CSS we should write something like this:
background:repeating-linear-gradient(45deg,lime ,green 25px ,lime 25px,green 50px );
which will create a 50x50 square like pattern above, but I cannot understand the logic behind this! Somewhere I read that two colors in same stop point will make the color sharper, but the interpolation and merging are not mentioned! I will be so glad if someone can help me to understand template used in CSS function.
Upvotes: 2
Views: 1660
Reputation: 89760
background:repeating-linear-gradient(45deg,lime ,green 25px ,lime 25px,green 50px );
This background setting can be interpreted as follows:
Without using repeating-linear-gradient
you would get only a 50px x 50px background image.
div {
height: 200px;
width: 200px;
border: 1px solid;
}
.repeating-gradient {
background: repeating-linear-gradient(45deg, lime, green 25px, lime 25px, green 50px);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
<div class="repeating-gradient"></div>
If you want to achieve an effect like in the image then you need to change your gradient to the below:
background: repeating-linear-gradient(45deg, lime, lime 25px, green 25px, green 50px);
This background setting can be interpreted as follows:
div {
height: 200px;
width: 200px;
border: 1px solid;
}
.repeating-gradient {
background: repeating-linear-gradient(45deg, lime, lime 25px, green 25px, green 50px);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
<div class="repeating-gradient"></div>
Upvotes: 3