Jump to content

Fully Square Button Styling

Go to solution Solved by Spark-Plugin,

Recommended Posts

Posted

Site URL: https://pug-hexahedron-nmyy.squarespace.com/

Hello!

I'm looking to make fully square buttons. I've achieved most of what I'd like, however, the placement of the text is at the top. Could you help me align it to the center? 

Code I'm using: 
 

.sqs-block-button-element {
  width:60% !important;
   box-sizing: border-box;
   min-height:120px;
   text-align:center !important;
}

https://pug-hexahedron-nmyy.squarespace.com/

Password: ruta

Thanks!

  • Solution
Posted

Hello @Anele0610, give this code a try and let me know how it goes:

.sqs-block-button-element {
  width: 60% !important;
  box-sizing: border-box;
  min-height: 120px;
  text-align: center !important;
  display: flex;
  align-items: center; /* Center vertically */
  justify-content: center; /* Center horizontally */
}

 

Screenshot 2024-10-28 at 09.11.38.png

- Answered by Iuno from sparkplugin.com

forumsignature-recommendedcopy2.png.0579645eb1430dc7c1059541dc6456c6.png

Posted

That did the trick 🙂
Any advice on the width/height being more responsive? The square shape changes once the screens get smaller now.. 

3 hours ago, Spark-Plugin said:

Hello @Anele0610, give this code a try and let me know how it goes:

.sqs-block-button-element {
  width: 60% !important;
  box-sizing: border-box;
  min-height: 120px;
  text-align: center !important;
  display: flex;
  align-items: center; /* Center vertically */
  justify-content: center; /* Center horizontally */
}

 

Screenshot 2024-10-28 at 09.11.38.png

 

Posted

@Anele0610, this code could do the trick as well: 

/* Responsive styles for mobile devices */
@media (max-width: 768px) {
    .sqs-block-button-element {
        width: 90% !important; /* Adjust width for mobile */
        min-height: 100px !important; /* Optionally adjust min-height for mobile */
        padding: 15px !important; /* Add padding if needed for better touch targets */
        font-size: 16px !important; /* Adjust font size if necessary */
    }
}

 

- Answered by Iuno from sparkplugin.com

forumsignature-recommendedcopy2.png.0579645eb1430dc7c1059541dc6456c6.png

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.