Jump to content

Flex Box aligned buttons only appear in editor

Go to solution Solved by tuanphan,

Recommended Posts

Site URL: https://www.kcostudios.squarespace.com

I'm looking to align two buttons in two columns, following different length text boxes. I didn't want to place a spacer because on mobile the buttons won't stick with their respective content.

 

I used a code on this site to achieve what I was looking for...great! BUT it only appears when I'm in the editor. If I use private mode on chrome or switch to safari my buttons disappear completely. I've removed the code from the site so the buttons are showing up, just unevenly. Any advice, please!?

The page in question is 

kcostudios.squarespace.com/team

password: demo

Black buttons under each long text box...

 

This is the code I had used previously:

 

     

/* TEAM align buttons */
@media only screen and (min-width: 767px) {
section[data-section-id="627d366c0e4da1155e256f49"] .sqs-row {
      display: flex !important;
      max-width: 100% !important;
  }

section[data-section-id="627d366c0e4da1155e256f49"] .sqs-col-4 {
      flex: 1 !important;
  }

section[data-section-id="627d366c0e4da1155e256f49"] .sqs-block.button-block.sqs-block-button {
      position: absolute !important;
      width: 39%;
      bottom: -9%;
  }
}

 

 

Screenshot 2022-07-01 at 16.31.23.png

Screenshot 2022-07-01 at 16.31.15.png

Link to comment
  • Solution

Use this new code

/* align 2 buttons */
@media screen and (min-width:768px) {
div#page-section-627d366c0e4da1155e256f49 {
.span-12>.row {
    display: flex;
}
.button-block {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
}
.span-5 {
    position: relative;
    flex: 1;
    padding-bottom: 100px;
}
}}

 

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

I have a follow-up question on how to repeat the above button alignment in other areas. I've tried applying this technique to a separate area (changing the page section id of course). I'm not really familiar with targeting with .span but from what I can see the same span numbers used in the previous solution apply to the second section I'd like to apply this to. It does alter it, but it's not working consistently as the other area does. Basically, when the browser gets very wide, they no longer align. What needs to be altered/targeted to ensure this works on additional areas?

 

The page in question is the homepage of Two square images with text and black buttons below.

kcostudios.com

password: demo

 

 

Thank you!

Screenshot 2022-07-04 at 16.39.52.png

Link to comment
7 hours ago, beckon said:

I have a follow-up question on how to repeat the above button alignment in other areas. I've tried applying this technique to a separate area (changing the page section id of course). I'm not really familiar with targeting with .span but from what I can see the same span numbers used in the previous solution apply to the second section I'd like to apply this to. It does alter it, but it's not working consistently as the other area does. Basically, when the browser gets very wide, they no longer align. What needs to be altered/targeted to ensure this works on additional areas?

 

The page in question is the homepage of Two square images with text and black buttons below.

kcostudios.com

password: demo

 

 

Thank you!

Screenshot 2022-07-04 at 16.39.52.png

It looks like you added an id in wrong place. Can you send the code you used?

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
@media screen and (min-width:768px) {
div#page-section-627d1b28df273e4ff75383d3
 {
.span-12>.row {
    display: flex;
}
.button-block {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
}
.span-5 {
    position: relative;
    flex: 1;
    padding-bottom: 100px;
}
}}

Here is the code I used, having altered the number 627d........83d3 from the original section id to reflect the the new area I'm looking to change.

Thanks for your time

Link to comment

Hmmm...I replaced the code as per above, but I'm afraid that made it worse!?

In the builder view it shrunk the image above the button and text and the button overlaps the text and doesn't align. 

In incognito mode it's better in that the buttons are vaguely aligned, but the image has reduced in size. 

 

 

Screenshot 2022-07-05 at 10.39.19.png

Screenshot 2022-07-05 at 10.38.13.png

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.