Reputation: 456
Why is the box on my paragraph tag really big? I think this may be the reason why I can't push the <p>
tag down with margin-top: 50px;
.train p {
margin: 0;
font-size: 2.5vw;
}
<div class="train">
<p class="train">In Training</p>
<hr>
</div>
Upvotes: 0
Views: 624
Reputation: 11342
A simple example for you to see the problem (also a good way to debug HTML/CSS). <p>
and <div>
those are by default block level
elements
Strongly suggest you to taking 3 mins to read the following link
REF: http://dustwell.com/div-span-inline-block.html
p.train {
margin: 0;
font-size: 2.5vw;
background: red;
}
<div>
<p class="train">In Training</p>
<hr>
</div>
Set p
to inline-block
just use a span
which is an inline element:
p.train {
margin: 0;
font-size: 2.5vw;
background: red;
display: inline-block;
}
.green {
margin: 0;
font-size: 2.5vw;
background: red;
}
<div>
<p class="train">In Training</p>
<hr>
<span class="green">In Training</span>
</div>
Upvotes: 0
Reputation: 303
The <p>
tag is a block element. Block level elements, regardless of their width, take an entire line to themselves within their parent. try wrapping a span around the piece that you want to style
Upvotes: 1