Jump to content

Text block with bespoke border and button inside?

Go to solution Solved by tuanphan,

Recommended Posts

Hi everyone, hope you're well.
 
Could anyone please help me understand the best way to emulate the elements in the attached screen grabs in Squarespace 7.1? This is the site the grabs are taken from. It's not ours, but it's what we want to emulate: https://meditateinireland.com
 
The three elements of text / button / offset line, all need to retain their relationship to each other as browser windows resize or mobile is used (as in screen grabs)
 
I have an idea how this could work which I'll detail below, but need help with the necessary code, OR advice on another way to approach the problem!
 
Possible solution: Create a text block with the 'block background' option turned on. This'll give a bit of internal padding to the block to keep the border offset from the text. Then use code to put a coloured border on just the left hand side of the block. Then use more code to place a button inside the text block. Putting the button inside the block would mean the border on the left of the block always extends down to the bottom of the button even when the block adapts to browser window resizes, as per screen grabs.
 
Am I on the right track? And if so, can anyone please point me to code which allows me to both alter the border of a text box in this way and to place a button inside?
 
Btw, I don't think this will work with text box 'quote' formatting because the line Squarespace puts on the left of a quote needs to extend to the lower edge of the button too. Also, there seems to be another issue with the line on the left of a quote needing code tweaks to appear outside of edit mode.
 
Thank you!
 

Screenshot 2023-10-25 at 11.18.13.png

Screenshot 2023-10-25 at 13.03.36.png

Link to comment

Possible solution: Create a text block with the 'block background' option turned on. This'll give a bit of internal padding to the block to keep the border offset from the text. Then use code to put a coloured border on just the left hand side of the block. Then use more code to place a button inside the text block. Putting the button inside the block would mean the border on the left of the block always extends down to the bottom of the button even when the block adapts to browser window resizes, as per screen grabs.

Yes. This is right direction.

With button, just add a hyperlink in Text Block, we can use CSS code to turn it to button

You can add text block first, then share link to page where you added it, we can give code

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
8 hours ago, tuanphan said:

Possible solution: Create a text block with the 'block background' option turned on. This'll give a bit of internal padding to the block to keep the border offset from the text. Then use code to put a coloured border on just the left hand side of the block. Then use more code to place a button inside the text block. Putting the button inside the block would mean the border on the left of the block always extends down to the bottom of the button even when the block adapts to browser window resizes, as per screen grabs.

Yes. This is right direction.

With button, just add a hyperlink in Text Block, we can use CSS code to turn it to button

You can add text block first, then share link to page where you added it, we can give code

Fantastic, thank you 🙂

This is our 'under construction' page with the text block at the top: https://www.meditateinthewestmidlands.co.uk/home-2

By the way, I replied to your email before seeing this message, so please disregard the email, thank you.

Link to comment
  • Solution

Add to Website Tools (under Not Linked) > Custom CSS

div#block-yui_3_17_2_1_1698166647126_15157 {
    border-left: 2px solid #dccb9e;
}
div#block-yui_3_17_2_1_1698166647126_15157 a {
    background-color: #798985;
    color: #dccbce;
    text-decoration: none !important;
    padding: 10px 20px;
    border-radius: 20px;
}

 

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
On 10/29/2023 at 1:09 AM, tuanphan said:

Add to Website Tools (under Not Linked) > Custom CSS

div#block-yui_3_17_2_1_1698166647126_15157 {
    border-left: 2px solid #dccb9e;
}
div#block-yui_3_17_2_1_1698166647126_15157 a {
    background-color: #798985;
    color: #dccbce;
    text-decoration: none !important;
    padding: 10px 20px;
    border-radius: 20px;
}

 

This is wonderful, thank you! There is one thing that needs modifying if you can help further though please - I removed the 'block background' from the text block as the padding at the top and the bottom of the block made the left border too long. The text block does still need padding, but just on the left hand side, in order to make the line set back from the text a bit - is there code we can add to create this?

Many thanks 🙂

Link to comment
52 minutes ago, Khechog said:

This is wonderful, thank you! There is one thing that needs modifying if you can help further though please - I removed the 'block background' from the text block as the padding at the top and the bottom of the block made the left border too long. The text block does still need padding, but just on the left hand side, in order to make the line set back from the text a bit - is there code we can add to create this?

Many thanks 🙂

Hi - no need to reply to this one - I found the answer in a reply you gave to someone else on this site. I added: 

padding-left: 30px !important;

to the first section of code you gave me.

Thank you once again 😄 Maybe there's a link where I could donate to your library project?

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.