Reputation: 33
I am just learning CSS, ive a project for a car sales website, but im trying to position text within a div, the paragraph code goes in fine, but when i put in the H1 tag, it moves the entire div down? (See below).
https://www.dropbox.com/s/px0zv5xw8vqpvpd/Screenshot%202014-03-12%2001.38.02.png
<div id="bottom">
<h1> Welcome to JJMurray Car Sales </h1>
<p class="hometext">
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p></div>
and the CSS:
#bottom{background-color:#d6d6d6;width:100%;height: 450px;
h1
{
text-align: left;
margin-left: 20px;
margin-right: 20px;
}
p.hometext
{
font-size: 14px;
font-family: calibri;
text-align:left;
width: 600px;
float: left;
margin-left: 20px;
margin-right: 20px;
Upvotes: 0
Views: 1712
Reputation: 3528
The heading tag in default occupies some margin.
And that default margin is making it appear with spaces around.
So, first try give h1 tag margin:0;
then, you can see how much space it is actually taking in default.
And as it is a block element you can specify maring: top left bottom right;
Upvotes: 1