tryllz
tryllz

Reputation: 33

Spacing between css elements

I am trying to add space between elements <header> and section <section> but they are stuck to each other, such that when I apply margin to the bottom of the the top element or at the top of the bottom element, the top element moves down along with the bottom element, this only happened after I added the footer.

And I did a search but I was not able to find solution for this.

Thanks to All..

.hclass {margin-bottom:20;} // header - the top most part, need space below this

.tryi {margin:top;} //section the second part, need space above this

#divfootr {width:100%;height:auto;position:absolute;bottom:0;text-align:center;} // footer code
<header class="hclass">
<nav id="indxpg">
	<div class="mainnav">
	</div>
</nav>
</header>

<section class="tryi">
	<div id="logotable">
	</div>
</section>

<footer class="footer">
    <div id="divfootr">
        <p><span class="copyright"><strong>&#169; 2016</strong></span></p>
    </div>
</footer>

Upvotes: 0

Views: 98

Answers (2)

lakhvir kumar
lakhvir kumar

Reputation: 265

Your missing px. .hclass{margin-top:20px}

Upvotes: 1

Nutshell
Nutshell

Reputation: 8537

Your way to add margin is incorrect. It must be something like this (for a fixed margin) :

margin-top:20px;

Upvotes: 3

Related Questions