Can't run this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can't run this code

I wanted to make the buttons aligned in the middle. @Sami Khan https://code.sololearn.com/WjGBbdKotGT6/?ref=app

6th Aug 2017, 10:22 AM
Code Master
Code Master - avatar
6 Answers
+ 5
Firstly, the class name of your buttons is 'Buttons', not 'buttons' (css is case sensitive). Second, the 'text-align:center;' isn't necessary (but do not breaking code ;)) Third, as you set the buttons as 'display:block;' your <br> between them introduce space (of one line-heigth)... to fix it, you have to remove them, or just by Css set negative values for top and bottom margin (weird fix: better to remove unnecessary <br> elements ;P) The working css rules: .Buttons { margin:-1.5ex auto; display: block; /* text-align: center;*/ }
7th Aug 2017, 11:23 AM
visph
visph - avatar
+ 1
I write it like the following : .buttons { margin: auto; display: block; text-align: center; }
6th Aug 2017, 11:01 AM
Code Master
Code Master - avatar
0
Add this to your .buttons : .buttons { margin: auto; }
6th Aug 2017, 10:46 AM
From The Muddy banks
0
Still not working
6th Aug 2017, 10:48 AM
Code Master
Code Master - avatar
0
I tried it and it worked. The 2 grey buttons are centered like this: button button
6th Aug 2017, 10:53 AM
From The Muddy banks
0
Exactly, and it works good for me when I run it.
6th Aug 2017, 11:11 AM
From The Muddy banks