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

2nd Jun 2019, 1:27 AM
Š”Š¾Š±ŠµŠ¶Š°Š» фуŠ¾ŠæŠ¹Š»ŃŒ ярŠ»Ń‹Ń‡Š¾Šŗ
Š”Š¾Š±ŠµŠ¶Š°Š» фуŠ¾ŠæŠ¹Š»ŃŒ ярŠ»Ń‹Ń‡Š¾Šŗ - avatar
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.
2nd Jun 2019, 3:31 AM
CalviÕ²
CalviÕ² - avatar
+ 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.
2nd Jun 2019, 2:13 AM
CalviÕ²
CalviÕ² - avatar
0
CalviÕ² whats the parent element?
2nd Jun 2019, 2:24 AM
Š”Š¾Š±ŠµŠ¶Š°Š» фуŠ¾ŠæŠ¹Š»ŃŒ ярŠ»Ń‹Ń‡Š¾Šŗ
Š”Š¾Š±ŠµŠ¶Š°Š» фуŠ¾ŠæŠ¹Š»ŃŒ ярŠ»Ń‹Ń‡Š¾Šŗ - avatar