Reputation: 31
I need to align the p
element to the bottom center of the page but something is wrong. I am making an HTML5 page.
Here is the CSS selector:
p { vertical-align:80px; }
Upvotes: 2
Views: 2067
Reputation: 17228
If you need exactly "align the p element to the bottom center of the page"
p {
position: absolute;
bottom: 0;
width: 100%;
text-align: center;
}
but it's not the best solution for most websites. Suppose, you are trying to make footer with some copyright (or year, or your name). In this case you have to use more complicated html and css, that includes main div, footer div, etc.
Upvotes: 2
Reputation: 2169
Please try this:
html,body{
marign: 0;
padding: 0;
height: 100%;
}
body:after {
content: "";
display: inline-block;
height: 100%;
width: 0;
}
p{
display: inline-block;
vertical-align: bottom;
}
Please view the demo. You will change the vertical-align
for p
, lay hime at top or middle.
Upvotes: 1