+ 4
How to align a button to center?
please give codes
7 Answers
+ 10
Something like this could work:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<style>
body {
text-align: center;
}
</style>
</head>
<body>
<button> This is a button </button>
</body>
</html>
Edit: No Problem :)
+ 6
you can use into a p or div tag and use align property
+ 4
Use CSS flex display
https://code.sololearn.com/WwrKexflTTXb/?ref=app
+ 2
ty Daniel
+ 2
So this is not my work and I honestly cannot remember who I copied it from. If this is your work please let me know and I'll credit you.
This code aligns your button in the center of the page both horizontally and vertically.
Basically, place your button into a div with centred text:
<div class="wrapper"> <button class="button">Button</button> </div>
With the following styles:
.wrapper { text-align: center; } .button { position: absolute; top: 50%; }
+ 1
ty LP4
0
ty Baltaza, but this is not my work