Reputation: 59
This is my HTML:
<div class="fourcol" align="center" ;="" style="float:;">
<h2 class="center" style="text-align: center;">More Mentors Announced Soon</h2>
The text itself is center justified, but I want it to be horizontally centered within the page. How can I do this?
This is the CSS I've been using with it
.fourcol, {
position: relative;
float: left;
margin-right: 2.762430939%;
margin-bottom: 20px;
margin-top: 20px;
}
h2.center {
width: 50%;
margin: 0 auto;
Upvotes: 0
Views: 102
Reputation: 782
try this one.change class fourcol to more
.more {
float: left;
width: 100%;
}
<div align="center" class="more">
<h2 style="text-align: center;" class="center">More Mentors Announced Soon</h2>
</div>
Upvotes: 2
Reputation: 8793
Just remove the width 50% line
h2.center {
width: 50%; //remove this line
margin: 0 auto;
}
EDIT
h2.center {
margin-top: 34%;
}
Upvotes: 0