Hi
I'm trying to center a div using CSS. I checked out some websites and they all say the same. I tried that, but I can't manage to center the div. The code I use is:
Maybe a little explanation what I want to do with all the styling:
-> class="pBodyTekst" is the standard styling to set the font etc.
-> the text-align is not meant to center the block, but to center the text inside
-> I try to center the block with the width and margin css properties
I tried it in a blank document without other style definitions and it didn't work either, so the other document styles are not disturbing the lay-out of the page.
What am I doing wrong?
Thanks
Steven
I'm trying to center a div using CSS. I checked out some websites and they all say the same. I tried that, but I can't manage to center the div. The code I use is:
Code:
<div class="pBodyTekst" style="border: solid 1px red; color: white; font-weight: bold; background-color: red; text-align: center; width: 80%; margin-left: auto; margin-right: auto">Chemicon antibody promotion!</div>
-> class="pBodyTekst" is the standard styling to set the font etc.
-> the text-align is not meant to center the block, but to center the text inside
-> I try to center the block with the width and margin css properties
I tried it in a blank document without other style definitions and it didn't work either, so the other document styles are not disturbing the lay-out of the page.
What am I doing wrong?
Thanks
Steven