How do I get rid of the whitespace above my 'subscribe to our newsletter' section











up vote
1
down vote

favorite












I want to get rid of the whitespace between the 'subscribe to our newsletter' section and the 'Affordable Professional Web Design' section.



I have already tried to set the margin to 0 for the bottom of the 'Affordable Professional Web Design' section and also the top margin for the 'subscribe to our newsletter' section but that doesn't seem to work.



This is how it looks like in a browser:



enter image description here



This is my HTML and CSS file:






.webdesignbannerdiv {
min-height: 400px;
background: blue;
padding-top: 20px;
text-align: center;
color: white;
margin-bottom: 0px;
}

.webdesignheader {
margin-top: 100px;
font-size: 55px;
}

.webdesignparagraph {
font-size: 20px;
margin-top: 5px;
}


/*newsletter section*/

.newsletterdiv {
margin-top: 0px;
padding: 15px;
color: white;
background-color: #35424a;
}

<section id="affordablewebdesignbanner">
<div class="webdesignbannerdiv">
<h1 class="webdesignheader">Affordable Professional Web Design</h1>
<p class="webdesignparagraph">Lorem ipsum dolor sit amet, consectetur </p>
</div>
</section>

<section id=subscribetonewsletter>
<div class="newsletterdiv">
<h1>Subscribe to our newsletter</h1>
<form>
<input type="email" placeholder="Enter Email...">
<button type="submit" class="newsletterbutton">Subscribe</button>
</form>
</div>
</section>





This is how i want it to look like:



enter image description here










share|improve this question




























    up vote
    1
    down vote

    favorite












    I want to get rid of the whitespace between the 'subscribe to our newsletter' section and the 'Affordable Professional Web Design' section.



    I have already tried to set the margin to 0 for the bottom of the 'Affordable Professional Web Design' section and also the top margin for the 'subscribe to our newsletter' section but that doesn't seem to work.



    This is how it looks like in a browser:



    enter image description here



    This is my HTML and CSS file:






    .webdesignbannerdiv {
    min-height: 400px;
    background: blue;
    padding-top: 20px;
    text-align: center;
    color: white;
    margin-bottom: 0px;
    }

    .webdesignheader {
    margin-top: 100px;
    font-size: 55px;
    }

    .webdesignparagraph {
    font-size: 20px;
    margin-top: 5px;
    }


    /*newsletter section*/

    .newsletterdiv {
    margin-top: 0px;
    padding: 15px;
    color: white;
    background-color: #35424a;
    }

    <section id="affordablewebdesignbanner">
    <div class="webdesignbannerdiv">
    <h1 class="webdesignheader">Affordable Professional Web Design</h1>
    <p class="webdesignparagraph">Lorem ipsum dolor sit amet, consectetur </p>
    </div>
    </section>

    <section id=subscribetonewsletter>
    <div class="newsletterdiv">
    <h1>Subscribe to our newsletter</h1>
    <form>
    <input type="email" placeholder="Enter Email...">
    <button type="submit" class="newsletterbutton">Subscribe</button>
    </form>
    </div>
    </section>





    This is how i want it to look like:



    enter image description here










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I want to get rid of the whitespace between the 'subscribe to our newsletter' section and the 'Affordable Professional Web Design' section.



      I have already tried to set the margin to 0 for the bottom of the 'Affordable Professional Web Design' section and also the top margin for the 'subscribe to our newsletter' section but that doesn't seem to work.



      This is how it looks like in a browser:



      enter image description here



      This is my HTML and CSS file:






      .webdesignbannerdiv {
      min-height: 400px;
      background: blue;
      padding-top: 20px;
      text-align: center;
      color: white;
      margin-bottom: 0px;
      }

      .webdesignheader {
      margin-top: 100px;
      font-size: 55px;
      }

      .webdesignparagraph {
      font-size: 20px;
      margin-top: 5px;
      }


      /*newsletter section*/

      .newsletterdiv {
      margin-top: 0px;
      padding: 15px;
      color: white;
      background-color: #35424a;
      }

      <section id="affordablewebdesignbanner">
      <div class="webdesignbannerdiv">
      <h1 class="webdesignheader">Affordable Professional Web Design</h1>
      <p class="webdesignparagraph">Lorem ipsum dolor sit amet, consectetur </p>
      </div>
      </section>

      <section id=subscribetonewsletter>
      <div class="newsletterdiv">
      <h1>Subscribe to our newsletter</h1>
      <form>
      <input type="email" placeholder="Enter Email...">
      <button type="submit" class="newsletterbutton">Subscribe</button>
      </form>
      </div>
      </section>





      This is how i want it to look like:



      enter image description here










      share|improve this question















      I want to get rid of the whitespace between the 'subscribe to our newsletter' section and the 'Affordable Professional Web Design' section.



      I have already tried to set the margin to 0 for the bottom of the 'Affordable Professional Web Design' section and also the top margin for the 'subscribe to our newsletter' section but that doesn't seem to work.



      This is how it looks like in a browser:



      enter image description here



      This is my HTML and CSS file:






      .webdesignbannerdiv {
      min-height: 400px;
      background: blue;
      padding-top: 20px;
      text-align: center;
      color: white;
      margin-bottom: 0px;
      }

      .webdesignheader {
      margin-top: 100px;
      font-size: 55px;
      }

      .webdesignparagraph {
      font-size: 20px;
      margin-top: 5px;
      }


      /*newsletter section*/

      .newsletterdiv {
      margin-top: 0px;
      padding: 15px;
      color: white;
      background-color: #35424a;
      }

      <section id="affordablewebdesignbanner">
      <div class="webdesignbannerdiv">
      <h1 class="webdesignheader">Affordable Professional Web Design</h1>
      <p class="webdesignparagraph">Lorem ipsum dolor sit amet, consectetur </p>
      </div>
      </section>

      <section id=subscribetonewsletter>
      <div class="newsletterdiv">
      <h1>Subscribe to our newsletter</h1>
      <form>
      <input type="email" placeholder="Enter Email...">
      <button type="submit" class="newsletterbutton">Subscribe</button>
      </form>
      </div>
      </section>





      This is how i want it to look like:



      enter image description here






      .webdesignbannerdiv {
      min-height: 400px;
      background: blue;
      padding-top: 20px;
      text-align: center;
      color: white;
      margin-bottom: 0px;
      }

      .webdesignheader {
      margin-top: 100px;
      font-size: 55px;
      }

      .webdesignparagraph {
      font-size: 20px;
      margin-top: 5px;
      }


      /*newsletter section*/

      .newsletterdiv {
      margin-top: 0px;
      padding: 15px;
      color: white;
      background-color: #35424a;
      }

      <section id="affordablewebdesignbanner">
      <div class="webdesignbannerdiv">
      <h1 class="webdesignheader">Affordable Professional Web Design</h1>
      <p class="webdesignparagraph">Lorem ipsum dolor sit amet, consectetur </p>
      </div>
      </section>

      <section id=subscribetonewsletter>
      <div class="newsletterdiv">
      <h1>Subscribe to our newsletter</h1>
      <form>
      <input type="email" placeholder="Enter Email...">
      <button type="submit" class="newsletterbutton">Subscribe</button>
      </form>
      </div>
      </section>





      .webdesignbannerdiv {
      min-height: 400px;
      background: blue;
      padding-top: 20px;
      text-align: center;
      color: white;
      margin-bottom: 0px;
      }

      .webdesignheader {
      margin-top: 100px;
      font-size: 55px;
      }

      .webdesignparagraph {
      font-size: 20px;
      margin-top: 5px;
      }


      /*newsletter section*/

      .newsletterdiv {
      margin-top: 0px;
      padding: 15px;
      color: white;
      background-color: #35424a;
      }

      <section id="affordablewebdesignbanner">
      <div class="webdesignbannerdiv">
      <h1 class="webdesignheader">Affordable Professional Web Design</h1>
      <p class="webdesignparagraph">Lorem ipsum dolor sit amet, consectetur </p>
      </div>
      </section>

      <section id=subscribetonewsletter>
      <div class="newsletterdiv">
      <h1>Subscribe to our newsletter</h1>
      <form>
      <input type="email" placeholder="Enter Email...">
      <button type="submit" class="newsletterbutton">Subscribe</button>
      </form>
      </div>
      </section>






      html css






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 11 at 8:58









      Temani Afif

      60.8k93472




      60.8k93472










      asked Nov 11 at 8:47









      Benard Manuh

      565




      565
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          You are facing a complex margin-collapsing as the p element has a default margin-bottom that is rendred outside of the section even if this one is having a min-height set. You may notice that this won't happen in all the browsers (on Firefox you won't see this gap).



          To fix this, simply remove that margin:






          .webdesignbannerdiv {
          min-height: 400px;
          background: blue;
          padding-top: 20px;
          text-align: center;
          color: white;
          margin-bottom: 0px;
          }

          .webdesignheader {
          margin-top: 100px;
          font-size: 55px;
          }

          .webdesignparagraph {
          font-size: 20px;
          margin-top: 5px;
          margin-bottom:0;
          }


          /*newsletter section*/

          .newsletterdiv {
          margin-top: 0px;
          padding: 15px;
          color: white;
          background-color: #35424a;
          }

          <section id="affordablewebdesignbanner">
          <div class="webdesignbannerdiv">
          <h1 class="webdesignheader">Affordable Professional Web Design</h1>
          <p class="webdesignparagraph">Lorem ipsum dolor sit amet, consectetur </p>
          </div>
          </section>

          <section id=subscribetonewsletter>
          <div class="newsletterdiv">
          <h1>Subscribe to our newsletter</h1>
          <form>
          <input type="email" placeholder="Enter Email...">
          <button type="submit" class="newsletterbutton">Subscribe</button>
          </form>
          </div>
          </section>








          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53247127%2fhow-do-i-get-rid-of-the-whitespace-above-my-subscribe-to-our-newsletter-sectio%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote



            accepted










            You are facing a complex margin-collapsing as the p element has a default margin-bottom that is rendred outside of the section even if this one is having a min-height set. You may notice that this won't happen in all the browsers (on Firefox you won't see this gap).



            To fix this, simply remove that margin:






            .webdesignbannerdiv {
            min-height: 400px;
            background: blue;
            padding-top: 20px;
            text-align: center;
            color: white;
            margin-bottom: 0px;
            }

            .webdesignheader {
            margin-top: 100px;
            font-size: 55px;
            }

            .webdesignparagraph {
            font-size: 20px;
            margin-top: 5px;
            margin-bottom:0;
            }


            /*newsletter section*/

            .newsletterdiv {
            margin-top: 0px;
            padding: 15px;
            color: white;
            background-color: #35424a;
            }

            <section id="affordablewebdesignbanner">
            <div class="webdesignbannerdiv">
            <h1 class="webdesignheader">Affordable Professional Web Design</h1>
            <p class="webdesignparagraph">Lorem ipsum dolor sit amet, consectetur </p>
            </div>
            </section>

            <section id=subscribetonewsletter>
            <div class="newsletterdiv">
            <h1>Subscribe to our newsletter</h1>
            <form>
            <input type="email" placeholder="Enter Email...">
            <button type="submit" class="newsletterbutton">Subscribe</button>
            </form>
            </div>
            </section>








            share|improve this answer



























              up vote
              1
              down vote



              accepted










              You are facing a complex margin-collapsing as the p element has a default margin-bottom that is rendred outside of the section even if this one is having a min-height set. You may notice that this won't happen in all the browsers (on Firefox you won't see this gap).



              To fix this, simply remove that margin:






              .webdesignbannerdiv {
              min-height: 400px;
              background: blue;
              padding-top: 20px;
              text-align: center;
              color: white;
              margin-bottom: 0px;
              }

              .webdesignheader {
              margin-top: 100px;
              font-size: 55px;
              }

              .webdesignparagraph {
              font-size: 20px;
              margin-top: 5px;
              margin-bottom:0;
              }


              /*newsletter section*/

              .newsletterdiv {
              margin-top: 0px;
              padding: 15px;
              color: white;
              background-color: #35424a;
              }

              <section id="affordablewebdesignbanner">
              <div class="webdesignbannerdiv">
              <h1 class="webdesignheader">Affordable Professional Web Design</h1>
              <p class="webdesignparagraph">Lorem ipsum dolor sit amet, consectetur </p>
              </div>
              </section>

              <section id=subscribetonewsletter>
              <div class="newsletterdiv">
              <h1>Subscribe to our newsletter</h1>
              <form>
              <input type="email" placeholder="Enter Email...">
              <button type="submit" class="newsletterbutton">Subscribe</button>
              </form>
              </div>
              </section>








              share|improve this answer

























                up vote
                1
                down vote



                accepted







                up vote
                1
                down vote



                accepted






                You are facing a complex margin-collapsing as the p element has a default margin-bottom that is rendred outside of the section even if this one is having a min-height set. You may notice that this won't happen in all the browsers (on Firefox you won't see this gap).



                To fix this, simply remove that margin:






                .webdesignbannerdiv {
                min-height: 400px;
                background: blue;
                padding-top: 20px;
                text-align: center;
                color: white;
                margin-bottom: 0px;
                }

                .webdesignheader {
                margin-top: 100px;
                font-size: 55px;
                }

                .webdesignparagraph {
                font-size: 20px;
                margin-top: 5px;
                margin-bottom:0;
                }


                /*newsletter section*/

                .newsletterdiv {
                margin-top: 0px;
                padding: 15px;
                color: white;
                background-color: #35424a;
                }

                <section id="affordablewebdesignbanner">
                <div class="webdesignbannerdiv">
                <h1 class="webdesignheader">Affordable Professional Web Design</h1>
                <p class="webdesignparagraph">Lorem ipsum dolor sit amet, consectetur </p>
                </div>
                </section>

                <section id=subscribetonewsletter>
                <div class="newsletterdiv">
                <h1>Subscribe to our newsletter</h1>
                <form>
                <input type="email" placeholder="Enter Email...">
                <button type="submit" class="newsletterbutton">Subscribe</button>
                </form>
                </div>
                </section>








                share|improve this answer














                You are facing a complex margin-collapsing as the p element has a default margin-bottom that is rendred outside of the section even if this one is having a min-height set. You may notice that this won't happen in all the browsers (on Firefox you won't see this gap).



                To fix this, simply remove that margin:






                .webdesignbannerdiv {
                min-height: 400px;
                background: blue;
                padding-top: 20px;
                text-align: center;
                color: white;
                margin-bottom: 0px;
                }

                .webdesignheader {
                margin-top: 100px;
                font-size: 55px;
                }

                .webdesignparagraph {
                font-size: 20px;
                margin-top: 5px;
                margin-bottom:0;
                }


                /*newsletter section*/

                .newsletterdiv {
                margin-top: 0px;
                padding: 15px;
                color: white;
                background-color: #35424a;
                }

                <section id="affordablewebdesignbanner">
                <div class="webdesignbannerdiv">
                <h1 class="webdesignheader">Affordable Professional Web Design</h1>
                <p class="webdesignparagraph">Lorem ipsum dolor sit amet, consectetur </p>
                </div>
                </section>

                <section id=subscribetonewsletter>
                <div class="newsletterdiv">
                <h1>Subscribe to our newsletter</h1>
                <form>
                <input type="email" placeholder="Enter Email...">
                <button type="submit" class="newsletterbutton">Subscribe</button>
                </form>
                </div>
                </section>








                .webdesignbannerdiv {
                min-height: 400px;
                background: blue;
                padding-top: 20px;
                text-align: center;
                color: white;
                margin-bottom: 0px;
                }

                .webdesignheader {
                margin-top: 100px;
                font-size: 55px;
                }

                .webdesignparagraph {
                font-size: 20px;
                margin-top: 5px;
                margin-bottom:0;
                }


                /*newsletter section*/

                .newsletterdiv {
                margin-top: 0px;
                padding: 15px;
                color: white;
                background-color: #35424a;
                }

                <section id="affordablewebdesignbanner">
                <div class="webdesignbannerdiv">
                <h1 class="webdesignheader">Affordable Professional Web Design</h1>
                <p class="webdesignparagraph">Lorem ipsum dolor sit amet, consectetur </p>
                </div>
                </section>

                <section id=subscribetonewsletter>
                <div class="newsletterdiv">
                <h1>Subscribe to our newsletter</h1>
                <form>
                <input type="email" placeholder="Enter Email...">
                <button type="submit" class="newsletterbutton">Subscribe</button>
                </form>
                </div>
                </section>





                .webdesignbannerdiv {
                min-height: 400px;
                background: blue;
                padding-top: 20px;
                text-align: center;
                color: white;
                margin-bottom: 0px;
                }

                .webdesignheader {
                margin-top: 100px;
                font-size: 55px;
                }

                .webdesignparagraph {
                font-size: 20px;
                margin-top: 5px;
                margin-bottom:0;
                }


                /*newsletter section*/

                .newsletterdiv {
                margin-top: 0px;
                padding: 15px;
                color: white;
                background-color: #35424a;
                }

                <section id="affordablewebdesignbanner">
                <div class="webdesignbannerdiv">
                <h1 class="webdesignheader">Affordable Professional Web Design</h1>
                <p class="webdesignparagraph">Lorem ipsum dolor sit amet, consectetur </p>
                </div>
                </section>

                <section id=subscribetonewsletter>
                <div class="newsletterdiv">
                <h1>Subscribe to our newsletter</h1>
                <form>
                <input type="email" placeholder="Enter Email...">
                <button type="submit" class="newsletterbutton">Subscribe</button>
                </form>
                </div>
                </section>






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 11 at 9:05

























                answered Nov 11 at 8:53









                Temani Afif

                60.8k93472




                60.8k93472






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53247127%2fhow-do-i-get-rid-of-the-whitespace-above-my-subscribe-to-our-newsletter-sectio%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Xamarin.iOS Cant Deploy on Iphone

                    Glorious Revolution

                    Dulmage-Mendelsohn matrix decomposition in Python