- This topic has 24 replies, 4 voices, and was last updated 2 years, 4 months ago by
Fernando.
-
AuthorPosts
-
October 13, 2022 at 9:35 am #2372580
Fergal
Hey there,
Can you please advise on how to style a button so that it is a circle?
Thanks,
FergalOctober 13, 2022 at 10:56 am #2372655Ying
StaffCustomer SupportHi Fergal,
Do you mean the oval shaped button?
You can apply this CSS to your buttons:
border-radius: 50%;
October 13, 2022 at 5:44 pm #2372861Fergal
Hey Ying,
Thanks for your reply. I’m currently using border-radius: 50% and the result is oval shaped buttons. Is their a way to make them circular?
Thanks,
FergalOctober 13, 2022 at 7:50 pm #2372913Fernando Customer Support
Hi Fergal,
You can try adjusting it to 100%, then set the paddings to somewhere around 35px top and bottom, then 10px left and right. This is just approximation though.
If you want a perfect Circle, you’ll need to turn the wrapper into a circle, then make the text float on top of that.
To do this, try adding
my-circle-button
to the Class list of the Button Wrapper.Then add this CSS:
.my-circle-button { position: relative; padding: 30px !important; background-color: var(--accent); border-radius: 100%; width: fit-content; } .my-circle-button > .gb-button { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 100px; margin: 0 !important; background-color: transparent !important; }
October 13, 2022 at 8:28 pm #2372927Fergal
Hey Fernando,
Thanks for your help and those instructions. On desktop it is now a circle which is great, but would like to reduce the size; maybe by half or more. And on mobile it is oval; can we please get it circle and reduce the size as well?
Thanks,
FergalOctober 13, 2022 at 9:13 pm #2372948Fernando Customer Support
You added the class to the Button, not the Button Wrapper. Can you try adding it to the Button Wrapper? Example: https://share.getcloudapp.com/kpuWl0EA
October 13, 2022 at 9:32 pm #2372955Fergal
Oops sorry I did add it to the button. I’ve now added it to the button wrapper.
Do I need to remove these settings from the button as well?
October 13, 2022 at 9:37 pm #2372963Fernando Customer Support
Yes, you can remove those.
October 13, 2022 at 9:46 pm #2372969Fergal
Great, thanks! I’ve now done that.
Any chance you can please help me get the circle shape on mobile and tablet? It is a very wide oval right now.
October 13, 2022 at 9:50 pm #2372973Fernando Customer Support
I see. I updated the code above. Can you test that?
October 13, 2022 at 10:22 pm #2372992Fergal
Sweet thanks Fernando! Much better. To make the circle a bit bigger do I just increase the padding here?
.my-circle-button { position: relative; padding: 30px !important; background-color: var(--accent); border-radius: 100%; width: fit-content; }
October 13, 2022 at 10:40 pm #2372994Fernando Customer Support
Yes, just increase it there. I also defined the color there but you can remove those parameter if you want to set it in the Block Settings of the Buttons Wrapper instead.
October 13, 2022 at 10:49 pm #2372999Fergal
Great it looks perfect, thanks for the amazing help as always.
October 13, 2022 at 11:28 pm #2373022Fernando Customer Support
You’re welcome Fergal!
October 14, 2022 at 6:04 pm #2374012Fergal
Hey Fernando,
Sorry to circle back to this, but could please use your help with one more thing here.
Can you please help me center the button on mobile and tablet?
I tried centering the blocks, but didn’t seem to do anything.
-
AuthorPosts
- You must be logged in to reply to this topic.