Reputation: 961
I've been having trouble aligning the terms of service and privacy policy message under the signup button of my page.
HTML:
<div class="signupterms"> <p>By clicking the sign up button you agree that you read the site's</p> <span><a href="terms.html">Terms of service</a></span><a href="privacy.html">Privacy Policy</a><p>and</p><a href="cookies.html">Cookie use</a>
</div>
CSS:
.signupterms {text-align:left; float:left; display:inline-block;}
.signupterms a {float:left; text-decoration:none; color:#000; }
.signupterms p {float:left; margin-left:4px;}
I've tried floating all the elements left, display:inline-block, but nothing seems to align the words perfectly, especially when resizing the browser window. It's probably something very obvious to fix, but I'm sure you guys can point me in the right direction and help me fix this problem. Thanks!
Upvotes: 0
Views: 2860
Reputation: 1615
the <p>
tag has display block by default and a margin...
just use one for the first statement and then spans to seperate links like so:
.signupterms {
text-align:left;
display:inline-block;
}
.signupterms a {
text-decoration:none;
color:#000;
}
.signupterms span {
margin-left:4px;
display:inline-block;
}
<div class="signupterms">
<p>By clicking the sign up button you agree that you read the site's</p> <span><a href="terms.html">Terms of service</a></span>,<span><a href="privacy.html">Privacy Policy</a></span> and <span><a href="cookies.html">Cookie use</a></span>
</div>
Upvotes: 0
Reputation: 3914
Your <p>
tags have margins which is making the text appear out of line with the anchor tags.
To be honest, I'd just put the links inside the the <p>
tag like below and then you don't need to worry about removing the margin from the <p>
tags.
.signupterms {text-align:left; float:left; display:inline-block;}
.signupterms a {text-decoration:none; color:#000; }
<div class="signupterms">
<p>
By clicking the sign up button you agree that you read the site's <a href="terms.html">Terms of service</a> <a href="privacy.html">Privacy Policy</a> and <a href="cookies.html">Cookie use</a>
</p>
</div>
Upvotes: 1
Reputation: 6470
p
tag have a default margin
. Remove it by adding margin:0;
to p
.
.signupterms p {float:left; margin-left:4px; margin:0;}
Upvotes: 0
Reputation: 2900
how about using <span>
?
http://jsfiddle.net/jyfvLrb3/1/
<p>
is a block element with some predefined styles, therefore its much better to use some inline without any properties, like <span>
Upvotes: 0