How can I align this submit button to the center? | SoloLearn: Learn to code for FREE!

+5

How can I align this submit button to the center?

https://code.sololearn.com/WA77ISF734Np/?ref=app

9/14/2020 3:53:37 PM

Srinath

26 Answers

New Answer

+6

Include this in your head tag <style> button{ width:100%; justify-content:center; } </style> OR <style> button{ position: relative; left:400px; } </style> In the 2nd method the alignment won't be perfect .You have to make it perfect by trial and error.If the button is more on left then increase the pixels in "left".Otherwise if it's on right side then decrease the pixels in left

+5

I edited it a little https://code.sololearn.com/WtTtP5LU5bfx/?ref=app

+5

Srinath, run the code again. I edited it

+4

You forgot to add an '=' after the attribute

+4

My pressure bro.👍 I hope you become good web developer 💐☺

+4

Just use center tag lol idk why everone keeps ignoring this powerful tag n go for css just to align

+4

Nice point Yash Singh

+4

You can use two methods that's 1. <p align ="center"></p> 2. <center>

+3

Srinath, you're welcome

+3

Jadene & Kayla Onobun Yeah got it

+3

Raghu Rao I think Srinath don't know CSS. He is in html part so It better to give him answer that relate to html course rather than giving something out of course.

+3

Sorry , I thought it would solve the problem cause it was basic css

+3

<button width=100% align="center"> I'm not sure if it works but give it a try

+3

No Problem I understand.It once happened with me too😅 No hard feelings 😊

+2

Jadene & Kayla Onobun Thanks a lot 🤠 but what it I wanted the Submit button alone to be aligned to the center and the rest to the left?

+2

Jadene & Kayla Onobun Oh thank you so much 😇

+2

Anshu Kumar Maybe he wouldn't have seen my profile. It's alright!

+2

Raghu Rao Thanks buddy, but i used <p align="center"> if you notice in the code

+2

Raghu Rao Thanks for those kind words bro 😇

+2

Arnav Kumar the answer he needs should be in html cause he is learning html . Also a answer like yours is posted above .Please don't write repetitive answers.