JasonWilson Posted November 19 Posted November 19 Site URL: https://www.shearwatercove.com/ I am using code to embed a button into a code block. I am copying and pasting the HTML code from the third party service into the code block. How do I center the button itself within the code block? Disclaimer - I am not familiar with coding at all. Can someone tell me what and exactly where to insert into my HTML below the necessary css to center the button? Thank you! <button class='flybook-book-now-button fb-widget-type-frontend fb-default-category-id-0 fb-account-id-1477 fb-entity-config-id- fb-domain-go.theflybook.com fb-protocol-https' style='background-color: #36b5aa;'>BOOK NOW!</button><link rel='stylesheet' href='https://go.theflybook.com/content/bootstrapper/flybookbootstrap.css' /><script src='https://go.theflybook.com/custom/bootstrapper/flybookbootstrap.js'></script>
Solution Spark-Plugin Posted November 19 Solution Posted November 19 (edited) Hello, @JasonWilson You can definitely center the button within the code block! Just replace your current code with this updated one below. See attached screeshot for reference: <div class="button-container"> <button class="flybook-book-now-button fb-widget-type-frontend fb-default-category-id-0 fb-account-id-1477 fb-entity-config-id- fb-domain-go.theflybook.com fb-protocol-https" style="background-color: #36b5aa;">BOOK NOW!</button> </div> <link rel="stylesheet" href="https://go.theflybook.com/content/bootstrapper/flybookbootstrap.css" /> <script src="https://go.theflybook.com/custom/bootstrapper/flybookbootstrap.js"></script> <style> /* Center the button horizontally */ .button-container { display: flex !important; /* Enables flexbox layout for alignment */ justify-content: center !important; /* Horizontally centers child elements */ align-items: center !important; /* Vertically centers child elements */ width: 100% !important; /* Ensures the container spans the full width of its parent */ } /* Style the button to maintain consistent appearance */ .flybook-book-now-button { padding: 10px 20px !important; /* Adds padding for better button aesthetics */ font-size: 1rem !important; /* Sets a readable font size */ border: none !important; /* Removes any default borders */ cursor: pointer !important; /* Changes cursor to a pointer on hover */ text-align: center !important; /* Ensures text is centered inside the button */ } /* Optional: Adjust button size for smaller screens */ @media (max-width: 768px) { .flybook-book-now-button { font-size: 0.9rem !important; /* Slightly smaller font for mobile */ padding: 8px 16px !important; /* Adjust padding for smaller screens */ } } </style> Edited November 19 by Spark-Plugin - Answered by Iuno from sparkplugin.com
JasonWilson Posted November 19 Author Posted November 19 Thank you so much!! That did the trick. Spark-Plugin 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment