Reputation: 758
I have three links. I want to align them like one in the left, one in the middle and one in the right in a single line. Say my links are prev(which I want place in the left of the line) home(which I want place in the middle of the line) and next(which I want place in the right of the line). So I wrote this code:
<a href="link">prev</a>
lots of
<a href="link">home</a>
lots of
<a href="link">next</a>`
I understood this is wrong because its a fixed size and will cause problem if I resize my window or in a relatively small screen. So I tried this:
<a href="link" align="left">prev</a>
<a href="link" align="center">home</a>
<a href="link" align="right">next</a>
But it didn't work! So how can I solve this problem with HTML?
`
Upvotes: 2
Views: 156
Reputation: 193261
Wrap links with a div container and use left/right floats and text-align: center
on the wrapper:
.wrap {
text-align: center;
background: #EEE;
padding: 10px;
}
.wrap .left {
float: left;
}
.wrap .right {
float: right;
}
<div class="wrap">
<a href="link" class="left">prev</a>
<a href="link">home</a>
<a href="link" class="right">next</a>
</div>
Upvotes: 1