+ 1
How to align a button?
I’ve made a button in css, but it doesn’t align to the center even though it has a text-align:center; Css: .SignUp{ Text-align:center; Border-radius:5px; Background-color:green; Padding:10px; Border:1px solid pink; Width:50px; } The button works, I just can’t align it to the center. Can anyone help?
4 ответов
+ 3
Parent element is the higher level element of the children elements
Check this out
https://code.sololearn.com/WLsqz8x30Z08/?ref=app
Take note: all css codes must be in lowercase form. you could add character "-" for class/id name for better readability, but not uppercase letter. css selector and property are strictly in lower case letters.
+ 1
Добежал фуопйль ярлычок your css already aligned the text of the button to center, relative to the button itself.
If you want to align the button to center, you need to set text-align center from the parent of the button element. The parent element must be block element with width to full width.
0
Calviղ whats the parent element?