Jump to content

How to add overlapping triangle background element

Recommended Posts

I can't seem to figure out how to add either a triangle background image or pseudo element that overlaps from one section to the next. I've attached an image of my homepage site design in Adobe XD, but I can't execute it on SS. The best I could do is manipulate the background image's overlay to form a triangle but it doesn't overlap with the next section. I attached the triangle I was trying to use to create the effect.

 

Background overlay:

section[data-section-id="63640eedfa630e7109f0410e"]  {

.section-background-overlay {
background:linear-gradient(-45deg, transparent 50%, #fff 50%);
z-index:1;
  opacity:.9!important;
	}
}

 

Here, I was able to get the triangle to show up as a background image and overlap with the next section, but it appears cut off and I'm not sure why.

Background image:

section[data-section-id="63640eedfa630e7109f0410e"]::after {
  content:'';
  background-image: url(https://static1.squarespace.com/static/63640ed0871b36563fa4c917/t/636431a8d4cb4d1fa7e3f8c5/1667510696435/triangle-2.png);
  position:absolute;
  width:100%;
  height:100%;
 z-index:1;
}

 

URL: https://chanceanddacompany.squarespace.com/
Password: construction

Screen Shot 2022-11-03 at 5.10.40 PM.png

triangle-2.png

Link to comment
2 hours ago, HaleyWard said:

I can't seem to figure out how to add either a triangle background image or pseudo element that overlaps from one section to the next. I've attached an image of my homepage site design in Adobe XD, but I can't execute it on SS. The best I could do is manipulate the background image's overlay to form a triangle but it doesn't overlap with the next section. I attached the triangle I was trying to use to create the effect.

 

Background overlay:

section[data-section-id="63640eedfa630e7109f0410e"]  {

.section-background-overlay {
background:linear-gradient(-45deg, transparent 50%, #fff 50%);
z-index:1;
  opacity:.9!important;
	}
}

 

Here, I was able to get the triangle to show up as a background image and overlap with the next section, but it appears cut off and I'm not sure why.

Background image:

section[data-section-id="63640eedfa630e7109f0410e"]::after {
  content:'';
  background-image: url(https://static1.squarespace.com/static/63640ed0871b36563fa4c917/t/636431a8d4cb4d1fa7e3f8c5/1667510696435/triangle-2.png);
  position:absolute;
  width:100%;
  height:100%;
 z-index:1;
}

 

URL: https://chanceanddacompany.squarespace.com/
Password: construction

Screen Shot 2022-11-03 at 5.10.40 PM.png

triangle-2.png

Can you check the background image of triangle?

It does not fit the image and the triangle is not at top and left

image.thumb.png.ad9a89fd608303ea290ba445f7b1e971.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - Lightbox captions only mode)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 No-code customisations for Squarespace
🚀 Learn how to rank new pages on Google in 48 hours!

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

Link to comment
On 11/4/2022 at 6:18 PM, HaleyWard said:

If I code the triangle to be positioned in the upper left corner it's still cut off. What do you suggest?

Screen Shot 2022-11-04 at 7.16.22 AM.png

Remove space inside image then use this new code

section[data-section-id="63640eedfa630e7109f0410e"]::after {
    content: '';
    background-image: url(https://static1.squarespace.com/static/63640ed0871b36563fa4c917/t/636431a8d4cb4d1fa7e3f8c5/1667510696435/triangle-2.png);
    position: absolute;
    width: 100%;
    height: 100%;
    bottom: 0;
    top: 0;
    z-index: 999999;
    left: 0;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: left;
}

image.png.c1cc995d7ea5b162c3ac6ea3d92be214.png

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Thank you, tuanphan! This is the code that worked for me:

section[data-section-id="63640eedfa630e7109f0410e"]::after {
    content: '';
    background-image: url(https://static1.squarespace.com/static/63640ed0871b36563fa4c917/t/63684929504397688b46a951/1667778857478/triangle.png);
    position: absolute;
    width: 150%;
    height: 150%;
    bottom: 0;
    top: -15vh;
    z-index: 1;
    left: -8vw;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: left;
}
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.