Reputation: 18531
How do I center the full page ? I tried adding my object.css.css file:
#content {
width: 700px ;
margin-left: auto ;
margin-right: auto ;
}
But that didnt help. I also tried:
.field
{
margin:auto;
width:70%;
}
But that didn't include h1
elements
Thanks. EDIT: https://i.sstatic.net/MeFSt.jpg
Upvotes: 0
Views: 2112
Reputation: 845
To center content we first wrap the page in a div, then center the #content within that wrapper div.
your css would look like:
#wrapper {
width: 100%;
height: auto;
}
#content {
margin: 0 auto;
width: 700px;
}
your html would look like:
<div id="wrapper">
<div id="content">
Content Stuffs
</div>
</div>
Upvotes: 1
Reputation: 1754
This isn't really a Ruby on Rails question as much as it is an HTML/CSS question. Your stylesheet should contain something like:
body {
text-align: center;
}
And of course, whatever other content your layout contains can have other effects.
Upvotes: 2
Reputation: 12524
To center elements on the page you use margin:0 auto;
and set a width but to center text within an element you would use text-align:center;
Upvotes: 1