+ 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 Answers
+ 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?