1
I created an element in the form of an "X" where at each end I want to use the same background. The background will only appear in the areas in red. I’ve tried using background-clip but I couldn’t and I don’t know if it’s the right way. Here’s an image of how you’d like it and html and css where I left off.
HTML and CSS: https://jsfiddle.net/wes_bp/58ozu6kq/
link code
* {
box-sizing: border-box;
font-family: 'Josefin Sans', sans-serif;
padding: 0;
margin: 0;
}
.shape-group{
height: 100vh;
width: 100vw;
}
ul,
li {
list-style: none;
padding: 0;
margin: 0;
}
.section-be-four ul.x-shape{
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
margin: 0;
padding: 0;
width: 800px;
height: 800px;
background: url(/assets/img/about1.jpg);
}
.section-be-four li{
position: absolute;
width: 311px;
height: 411px;
background: blue;
transform: rotate(-45deg);
transition: .5s;
}
.section-be-four .shape-1{
top: 0;
left: 0;
}
.section-be-four .shape-1::before{
content: "";
}
.section-be-four .shape-2{
top: 0;
left: 63%;
transform: rotate(45deg);
}
.section-be-four .shape-3{
background: yellow;
transform: rotate(45deg);
height: 311px;
top: 38.5%;
left: 31.5%;
}
.section-be-four .shape-4{
top: 63%;
transform: rotate(45deg);
}
.section-be-four .shape-5{
top: 63%;
left: 63%;
}
<section class="section-be-four section-four">
<div class="col-full">
<div class="shape-group">
<ul class="x-shape">
<li class="shape shape-1"><div class="shape-bg-1"></div></li>
<li class="shape shape-2"><div class="shape-bg-2"></div></li>
<li class="shape shape-3"><div class="shape-bg-3"></div></li>
<li class="shape shape-4"><div class="shape-bg-4"></div></li>
<li class="shape shape-5"><div class="shape-bg-5"></div></li>
</ul>
</div>
</div>
</section>
Since it’s for simplicity, take out this ugly text-shadow rsrsrs. + 1 for the lean solution anyway.
– bfavaretto
@bfavaretto hahaha is pq I wanted to ensure the contrast of the text since it does not give to know the image that comes from CDN... But this is to the taste of the customer, you can even use Comic Sans if you want
– hugocsl
Thanks @hugocsl helped me D+ ! For now I’ll just do a copy/Stop of what you did to advance the step here, but I wonder if you used any tool to do svg if yes which ? Abç!
– wbp
@wbp I’m glad you helped out there. I used Figma, it’s free and runs in the browser, you draw there and already export as SVG, which by the way the SVG exported by it is of great code quality, very clean!
– hugocsl
Thanks again @hugocsl! Hug!
– wbp