0

I'm Coding a sign in/sign up website, the css is very basic at this time along with basic js (I plan on polishing css). But I want to get the basic css done before working on html, one element of my website is an h3 element that I want to have a margin that pushes from the bottom of one of the selection divs but the margin is pushing from the top of the body rather than the containing div.

<div id="container">
    <div id="leftFloat" class="50%">sign in</div>
    <div id="rightFloat" class="50%">sign up</div>
    <div id="rightFloat" class="50%">
    <h2 id="selection" class="margin: 50px;">Pushes the container down rather than pushing itself down</h2>
    </div>
</div>

This is what i want When Using The Margin

This is what i get when using the margin

Papi Woody
  • 13
  • 2
  • I have looked a lot on google, and could not find the answer to the question I had, I've come up with my own solution because nothing has worked. If you think there could be an answer to this question please link it to me so that I could fix my site. Because I can not edit this question to be somehow different if I do not know what question I've duplicated. – Papi Woody Oct 30 '18 at 09:19

1 Answers1

0

Use clear:both for h2 as shown below:

h2{
    clear: both;
}
Vikas Jadhav
  • 4,597
  • 2
  • 19
  • 37