Currently, I am utilizing the Bootstrap 3 framework.
In order to center a button that is 300px
wide horizontally on the screen, I have implemented the following CSS code which incorporates the use of calc
:
.kiosk-form .centered
{
margin-left: calc(50% - 150px);
}
Although in the provided code snippet, I am keen on substituting 150px
with something like "element.width/2"
, aiming to eliminate the fixed half-width in pixels, I am currently facing challenges doing so.
If anyone could suggest a solution, it would be greatly appreciated.
Additionally, I'm curious whether there is an alternative method to achieve horizontal centering for a button?