+ 2
Why the Text-align: center; wont work?
I am just confused I tried everything and nothing happened.
17 Réponses
+ 5
I don't have Opera, so I'll post this for you to try first, and if not, I'll download Opera so I can see it first-hand.
Change .buttonContainer to:
.buttonContainer {
width: 100%;
text-align: center;
margin: 0 auto;
}
+ 3
https://code.sololearn.com/W43dH3oUgeXl/#html
.buttonContainer {
text-align: center;
}
<div class="buttonContainer">
<button class="button" onclick="alert('Thanks For supporting')" align="center">Yes</button>
<button class="button" onclick="alert('Contact us')" align="center">No</button>
</div>
+ 2
I just remembered all the things I hate about web development. :)
Anyways, it could be many reasons, because many things affect the alignment of it. You may need to nest your element, maybe fix what's set on its parent, try margin: 0 auto;, try text-align: center;, etc....
Honestly, without seeing your code, it's hard to be specific on it. Post up your code and we can let you know for certain what's causing it.
+ 2
Ok thanks for helping I really appreciate your answers
+ 1
Yup, I'm sure; at least with Chrome browser. Most of the time you just need to nest the elements you want centered and then align the container. Sometimes "margin: 0 auto;" is really useful for the trickier elements that won't center. Really just depends, not everything acts in the same way that you'd expect.
What browser are you using Yaman? It works flawlessly on my end, but again, I'm using Chrome. I'll test it in other browsers and adjust the code to make sure it works in the browser you prefer. This is the part of web development that I hated the most; y u no force standards?
+ 1
It worked perfectly
+ 1
it worked
+ 1
@Yaman
Okay, perfect! If you have a piece of paper or something, write all of those things down for future reference. 99% of the time, one of those things I mentioned fixes the problem with centering.
0
Wait a min
0
The last 2 buttons
0
I post it already
0
are you sure?
0
It isnt working
0
I am using Opera
0
Ok I'll try
0
You're welcome.