Want to Put button below vertically centered DIV












3















I have 3 divs in page. 1st for logo, second for contents which I have vertically centered and last for button which will then let user navigate to another section/page.



I am trying to put button below centered div but somehow it is appearing below logo.



I would like this page to be displayed appropriately on both desktop and different mobiles hence I am not using fixed bottom margin.



Please let me know if I am missing something.



    <!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Title</title>
<style>
.center-div
{
position: absolute;
top: 50%;
left:50%;
margin-right:-50%;
transform: translate(-50%,-50%);
width:100%;
border: 3px solid red;
background-color:peachpuff;
text-align:center;
}
</style>
</head>
<body>
<div>
<div>
<h1>Logo</h1>
</div>
<div class="center-div">
<h1>Title of paragraph</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum. Sed dapibus pulvinar nibh tempor porta.</p>
</div>
<div style="text-align:center;">
<a target="_blank" href="" class="btn btn-primary" style="text-decoration:none;">Explore More »</a>
</div>
<div>
</body>
</html>









share|improve this question



























    3















    I have 3 divs in page. 1st for logo, second for contents which I have vertically centered and last for button which will then let user navigate to another section/page.



    I am trying to put button below centered div but somehow it is appearing below logo.



    I would like this page to be displayed appropriately on both desktop and different mobiles hence I am not using fixed bottom margin.



    Please let me know if I am missing something.



        <!doctype html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Title</title>
    <style>
    .center-div
    {
    position: absolute;
    top: 50%;
    left:50%;
    margin-right:-50%;
    transform: translate(-50%,-50%);
    width:100%;
    border: 3px solid red;
    background-color:peachpuff;
    text-align:center;
    }
    </style>
    </head>
    <body>
    <div>
    <div>
    <h1>Logo</h1>
    </div>
    <div class="center-div">
    <h1>Title of paragraph</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum. Sed dapibus pulvinar nibh tempor porta.</p>
    </div>
    <div style="text-align:center;">
    <a target="_blank" href="" class="btn btn-primary" style="text-decoration:none;">Explore More »</a>
    </div>
    <div>
    </body>
    </html>









    share|improve this question

























      3












      3








      3








      I have 3 divs in page. 1st for logo, second for contents which I have vertically centered and last for button which will then let user navigate to another section/page.



      I am trying to put button below centered div but somehow it is appearing below logo.



      I would like this page to be displayed appropriately on both desktop and different mobiles hence I am not using fixed bottom margin.



      Please let me know if I am missing something.



          <!doctype html>
      <html lang="en">
      <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <title>Title</title>
      <style>
      .center-div
      {
      position: absolute;
      top: 50%;
      left:50%;
      margin-right:-50%;
      transform: translate(-50%,-50%);
      width:100%;
      border: 3px solid red;
      background-color:peachpuff;
      text-align:center;
      }
      </style>
      </head>
      <body>
      <div>
      <div>
      <h1>Logo</h1>
      </div>
      <div class="center-div">
      <h1>Title of paragraph</h1>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum. Sed dapibus pulvinar nibh tempor porta.</p>
      </div>
      <div style="text-align:center;">
      <a target="_blank" href="" class="btn btn-primary" style="text-decoration:none;">Explore More »</a>
      </div>
      <div>
      </body>
      </html>









      share|improve this question














      I have 3 divs in page. 1st for logo, second for contents which I have vertically centered and last for button which will then let user navigate to another section/page.



      I am trying to put button below centered div but somehow it is appearing below logo.



      I would like this page to be displayed appropriately on both desktop and different mobiles hence I am not using fixed bottom margin.



      Please let me know if I am missing something.



          <!doctype html>
      <html lang="en">
      <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <title>Title</title>
      <style>
      .center-div
      {
      position: absolute;
      top: 50%;
      left:50%;
      margin-right:-50%;
      transform: translate(-50%,-50%);
      width:100%;
      border: 3px solid red;
      background-color:peachpuff;
      text-align:center;
      }
      </style>
      </head>
      <body>
      <div>
      <div>
      <h1>Logo</h1>
      </div>
      <div class="center-div">
      <h1>Title of paragraph</h1>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum. Sed dapibus pulvinar nibh tempor porta.</p>
      </div>
      <div style="text-align:center;">
      <a target="_blank" href="" class="btn btn-primary" style="text-decoration:none;">Explore More »</a>
      </div>
      <div>
      </body>
      </html>






      html css






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 24 '18 at 12:47









      VrushaliVrushali

      215




      215
























          4 Answers
          4






          active

          oldest

          votes


















          1














          I'm not sure that this is the result that you want but if you change the position: absolute; to position: relative; then they will be put in the right order.






          share|improve this answer
























          • I would like the content div to be at vertical center of screen. If position value is changed then div does not remain at center.

            – Vrushali
            Nov 24 '18 at 13:16



















          1














          You can achieve this without positioning.
          Use display:table for container and display: table-cell; vertical-align: middle for content.
          Also you must to set height 100% for html/body and container elements.
          P.S. Display table and table-cell will not work on IE7. But this browser is a history. Use it freely. Here is good article about this (don't be decieved by it's title).



          And this is the code you need:



          <!doctype html>
          <html lang="en">
          <head>
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <meta http-equiv="X-UA-Compatible" content="ie=edge">
          <title>Title</title>
          <style>
          html,body {height: 100%;}

          .container{
          display: table;
          height: 100%;
          }

          .content-wrapper{
          display: table-cell;
          vertical-align: middle;
          }

          .link{
          text-align: center;
          }
          </style>
          </head>
          <body>
          <header>
          <h1>Logo</h1>
          </header>
          <div class="container">
          <div class="content-wrapper">
          <div>
          <h2>Title of paragraph</h2>
          <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum. Sed dapibus pulvinar nibh tempor porta.</p>
          </div>
          <div class="link">
          <a target="_blank" href="" class="btn btn-primary" style="text-decoration:none;">Explore More »</a>
          </div>
          </div>
          </div>
          </body>
          </html>





          share|improve this answer































            0














            You can achieve the desired disposition with some simple CSS.



            I have made you an example here:






             .center-div {
            border: 3px solid red;
            background-color: peachpuff;
            text-align: center;
            margin: 10px;
            }

            .logo {
            text-align: center;
            }

            .myButton {
            text-align: center;
            }

              <div>
            <div class="logo">
            <h1>Logo</h1>
            </div>
            </div>
            <div>
            <div class="center-div">
            <h1>Title of paragraph</h1>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus
            vestibulum augue ut aliquet. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum.
            Sed dapibus pulvinar nibh tempor porta.</p>
            </div>
            </div>
            <div>
            <div class="myButton">
            <a target="_blank" href="" class="btn btn-primary" style="text-decoration:none;">Explore More »</a>
            </div>
            </div>





            In your post you mentioned "I would like this page to be displayed appropriately on both desktop and different mobiles hence I am not using fixed bottom margin."



            You can have this behavior by using either Bootstrap Columns or Foundation Columns. they very helpful in resizing your content for different viewports.



            If you use foundation you could have the following:



            <div class="row">
            <div class="small-2 large-4 columns myButton">


            In this case the column will auto-resize an take a space up to 2 in small viewports. Meanwhile for medium and above(tablets, desktops) it will take 4.






            share|improve this answer

































              -1














              Just remove the "position" and "transform" attribute from the ".center-div" styling!! Then remove the "text-align" & add some "padding-left" to the button.. I hope it'll work:)






              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',
                autoActivateHeartbeat: false,
                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%2f53458303%2fwant-to-put-button-below-vertically-centered-div%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                1














                I'm not sure that this is the result that you want but if you change the position: absolute; to position: relative; then they will be put in the right order.






                share|improve this answer
























                • I would like the content div to be at vertical center of screen. If position value is changed then div does not remain at center.

                  – Vrushali
                  Nov 24 '18 at 13:16
















                1














                I'm not sure that this is the result that you want but if you change the position: absolute; to position: relative; then they will be put in the right order.






                share|improve this answer
























                • I would like the content div to be at vertical center of screen. If position value is changed then div does not remain at center.

                  – Vrushali
                  Nov 24 '18 at 13:16














                1












                1








                1







                I'm not sure that this is the result that you want but if you change the position: absolute; to position: relative; then they will be put in the right order.






                share|improve this answer













                I'm not sure that this is the result that you want but if you change the position: absolute; to position: relative; then they will be put in the right order.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 24 '18 at 13:01









                Dries AugustynsDries Augustyns

                146




                146













                • I would like the content div to be at vertical center of screen. If position value is changed then div does not remain at center.

                  – Vrushali
                  Nov 24 '18 at 13:16



















                • I would like the content div to be at vertical center of screen. If position value is changed then div does not remain at center.

                  – Vrushali
                  Nov 24 '18 at 13:16

















                I would like the content div to be at vertical center of screen. If position value is changed then div does not remain at center.

                – Vrushali
                Nov 24 '18 at 13:16





                I would like the content div to be at vertical center of screen. If position value is changed then div does not remain at center.

                – Vrushali
                Nov 24 '18 at 13:16













                1














                You can achieve this without positioning.
                Use display:table for container and display: table-cell; vertical-align: middle for content.
                Also you must to set height 100% for html/body and container elements.
                P.S. Display table and table-cell will not work on IE7. But this browser is a history. Use it freely. Here is good article about this (don't be decieved by it's title).



                And this is the code you need:



                <!doctype html>
                <html lang="en">
                <head>
                <meta charset="UTF-8">
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
                <meta http-equiv="X-UA-Compatible" content="ie=edge">
                <title>Title</title>
                <style>
                html,body {height: 100%;}

                .container{
                display: table;
                height: 100%;
                }

                .content-wrapper{
                display: table-cell;
                vertical-align: middle;
                }

                .link{
                text-align: center;
                }
                </style>
                </head>
                <body>
                <header>
                <h1>Logo</h1>
                </header>
                <div class="container">
                <div class="content-wrapper">
                <div>
                <h2>Title of paragraph</h2>
                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum. Sed dapibus pulvinar nibh tempor porta.</p>
                </div>
                <div class="link">
                <a target="_blank" href="" class="btn btn-primary" style="text-decoration:none;">Explore More »</a>
                </div>
                </div>
                </div>
                </body>
                </html>





                share|improve this answer




























                  1














                  You can achieve this without positioning.
                  Use display:table for container and display: table-cell; vertical-align: middle for content.
                  Also you must to set height 100% for html/body and container elements.
                  P.S. Display table and table-cell will not work on IE7. But this browser is a history. Use it freely. Here is good article about this (don't be decieved by it's title).



                  And this is the code you need:



                  <!doctype html>
                  <html lang="en">
                  <head>
                  <meta charset="UTF-8">
                  <meta name="viewport" content="width=device-width, initial-scale=1.0">
                  <meta http-equiv="X-UA-Compatible" content="ie=edge">
                  <title>Title</title>
                  <style>
                  html,body {height: 100%;}

                  .container{
                  display: table;
                  height: 100%;
                  }

                  .content-wrapper{
                  display: table-cell;
                  vertical-align: middle;
                  }

                  .link{
                  text-align: center;
                  }
                  </style>
                  </head>
                  <body>
                  <header>
                  <h1>Logo</h1>
                  </header>
                  <div class="container">
                  <div class="content-wrapper">
                  <div>
                  <h2>Title of paragraph</h2>
                  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum. Sed dapibus pulvinar nibh tempor porta.</p>
                  </div>
                  <div class="link">
                  <a target="_blank" href="" class="btn btn-primary" style="text-decoration:none;">Explore More »</a>
                  </div>
                  </div>
                  </div>
                  </body>
                  </html>





                  share|improve this answer


























                    1












                    1








                    1







                    You can achieve this without positioning.
                    Use display:table for container and display: table-cell; vertical-align: middle for content.
                    Also you must to set height 100% for html/body and container elements.
                    P.S. Display table and table-cell will not work on IE7. But this browser is a history. Use it freely. Here is good article about this (don't be decieved by it's title).



                    And this is the code you need:



                    <!doctype html>
                    <html lang="en">
                    <head>
                    <meta charset="UTF-8">
                    <meta name="viewport" content="width=device-width, initial-scale=1.0">
                    <meta http-equiv="X-UA-Compatible" content="ie=edge">
                    <title>Title</title>
                    <style>
                    html,body {height: 100%;}

                    .container{
                    display: table;
                    height: 100%;
                    }

                    .content-wrapper{
                    display: table-cell;
                    vertical-align: middle;
                    }

                    .link{
                    text-align: center;
                    }
                    </style>
                    </head>
                    <body>
                    <header>
                    <h1>Logo</h1>
                    </header>
                    <div class="container">
                    <div class="content-wrapper">
                    <div>
                    <h2>Title of paragraph</h2>
                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum. Sed dapibus pulvinar nibh tempor porta.</p>
                    </div>
                    <div class="link">
                    <a target="_blank" href="" class="btn btn-primary" style="text-decoration:none;">Explore More »</a>
                    </div>
                    </div>
                    </div>
                    </body>
                    </html>





                    share|improve this answer













                    You can achieve this without positioning.
                    Use display:table for container and display: table-cell; vertical-align: middle for content.
                    Also you must to set height 100% for html/body and container elements.
                    P.S. Display table and table-cell will not work on IE7. But this browser is a history. Use it freely. Here is good article about this (don't be decieved by it's title).



                    And this is the code you need:



                    <!doctype html>
                    <html lang="en">
                    <head>
                    <meta charset="UTF-8">
                    <meta name="viewport" content="width=device-width, initial-scale=1.0">
                    <meta http-equiv="X-UA-Compatible" content="ie=edge">
                    <title>Title</title>
                    <style>
                    html,body {height: 100%;}

                    .container{
                    display: table;
                    height: 100%;
                    }

                    .content-wrapper{
                    display: table-cell;
                    vertical-align: middle;
                    }

                    .link{
                    text-align: center;
                    }
                    </style>
                    </head>
                    <body>
                    <header>
                    <h1>Logo</h1>
                    </header>
                    <div class="container">
                    <div class="content-wrapper">
                    <div>
                    <h2>Title of paragraph</h2>
                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum. Sed dapibus pulvinar nibh tempor porta.</p>
                    </div>
                    <div class="link">
                    <a target="_blank" href="" class="btn btn-primary" style="text-decoration:none;">Explore More »</a>
                    </div>
                    </div>
                    </div>
                    </body>
                    </html>






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 24 '18 at 14:08









                    callOfCodecallOfCode

                    53448




                    53448























                        0














                        You can achieve the desired disposition with some simple CSS.



                        I have made you an example here:






                         .center-div {
                        border: 3px solid red;
                        background-color: peachpuff;
                        text-align: center;
                        margin: 10px;
                        }

                        .logo {
                        text-align: center;
                        }

                        .myButton {
                        text-align: center;
                        }

                          <div>
                        <div class="logo">
                        <h1>Logo</h1>
                        </div>
                        </div>
                        <div>
                        <div class="center-div">
                        <h1>Title of paragraph</h1>
                        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus
                        vestibulum augue ut aliquet. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum.
                        Sed dapibus pulvinar nibh tempor porta.</p>
                        </div>
                        </div>
                        <div>
                        <div class="myButton">
                        <a target="_blank" href="" class="btn btn-primary" style="text-decoration:none;">Explore More »</a>
                        </div>
                        </div>





                        In your post you mentioned "I would like this page to be displayed appropriately on both desktop and different mobiles hence I am not using fixed bottom margin."



                        You can have this behavior by using either Bootstrap Columns or Foundation Columns. they very helpful in resizing your content for different viewports.



                        If you use foundation you could have the following:



                        <div class="row">
                        <div class="small-2 large-4 columns myButton">


                        In this case the column will auto-resize an take a space up to 2 in small viewports. Meanwhile for medium and above(tablets, desktops) it will take 4.






                        share|improve this answer






























                          0














                          You can achieve the desired disposition with some simple CSS.



                          I have made you an example here:






                           .center-div {
                          border: 3px solid red;
                          background-color: peachpuff;
                          text-align: center;
                          margin: 10px;
                          }

                          .logo {
                          text-align: center;
                          }

                          .myButton {
                          text-align: center;
                          }

                            <div>
                          <div class="logo">
                          <h1>Logo</h1>
                          </div>
                          </div>
                          <div>
                          <div class="center-div">
                          <h1>Title of paragraph</h1>
                          <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus
                          vestibulum augue ut aliquet. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum.
                          Sed dapibus pulvinar nibh tempor porta.</p>
                          </div>
                          </div>
                          <div>
                          <div class="myButton">
                          <a target="_blank" href="" class="btn btn-primary" style="text-decoration:none;">Explore More »</a>
                          </div>
                          </div>





                          In your post you mentioned "I would like this page to be displayed appropriately on both desktop and different mobiles hence I am not using fixed bottom margin."



                          You can have this behavior by using either Bootstrap Columns or Foundation Columns. they very helpful in resizing your content for different viewports.



                          If you use foundation you could have the following:



                          <div class="row">
                          <div class="small-2 large-4 columns myButton">


                          In this case the column will auto-resize an take a space up to 2 in small viewports. Meanwhile for medium and above(tablets, desktops) it will take 4.






                          share|improve this answer




























                            0












                            0








                            0







                            You can achieve the desired disposition with some simple CSS.



                            I have made you an example here:






                             .center-div {
                            border: 3px solid red;
                            background-color: peachpuff;
                            text-align: center;
                            margin: 10px;
                            }

                            .logo {
                            text-align: center;
                            }

                            .myButton {
                            text-align: center;
                            }

                              <div>
                            <div class="logo">
                            <h1>Logo</h1>
                            </div>
                            </div>
                            <div>
                            <div class="center-div">
                            <h1>Title of paragraph</h1>
                            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus
                            vestibulum augue ut aliquet. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum.
                            Sed dapibus pulvinar nibh tempor porta.</p>
                            </div>
                            </div>
                            <div>
                            <div class="myButton">
                            <a target="_blank" href="" class="btn btn-primary" style="text-decoration:none;">Explore More »</a>
                            </div>
                            </div>





                            In your post you mentioned "I would like this page to be displayed appropriately on both desktop and different mobiles hence I am not using fixed bottom margin."



                            You can have this behavior by using either Bootstrap Columns or Foundation Columns. they very helpful in resizing your content for different viewports.



                            If you use foundation you could have the following:



                            <div class="row">
                            <div class="small-2 large-4 columns myButton">


                            In this case the column will auto-resize an take a space up to 2 in small viewports. Meanwhile for medium and above(tablets, desktops) it will take 4.






                            share|improve this answer















                            You can achieve the desired disposition with some simple CSS.



                            I have made you an example here:






                             .center-div {
                            border: 3px solid red;
                            background-color: peachpuff;
                            text-align: center;
                            margin: 10px;
                            }

                            .logo {
                            text-align: center;
                            }

                            .myButton {
                            text-align: center;
                            }

                              <div>
                            <div class="logo">
                            <h1>Logo</h1>
                            </div>
                            </div>
                            <div>
                            <div class="center-div">
                            <h1>Title of paragraph</h1>
                            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus
                            vestibulum augue ut aliquet. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum.
                            Sed dapibus pulvinar nibh tempor porta.</p>
                            </div>
                            </div>
                            <div>
                            <div class="myButton">
                            <a target="_blank" href="" class="btn btn-primary" style="text-decoration:none;">Explore More »</a>
                            </div>
                            </div>





                            In your post you mentioned "I would like this page to be displayed appropriately on both desktop and different mobiles hence I am not using fixed bottom margin."



                            You can have this behavior by using either Bootstrap Columns or Foundation Columns. they very helpful in resizing your content for different viewports.



                            If you use foundation you could have the following:



                            <div class="row">
                            <div class="small-2 large-4 columns myButton">


                            In this case the column will auto-resize an take a space up to 2 in small viewports. Meanwhile for medium and above(tablets, desktops) it will take 4.






                             .center-div {
                            border: 3px solid red;
                            background-color: peachpuff;
                            text-align: center;
                            margin: 10px;
                            }

                            .logo {
                            text-align: center;
                            }

                            .myButton {
                            text-align: center;
                            }

                              <div>
                            <div class="logo">
                            <h1>Logo</h1>
                            </div>
                            </div>
                            <div>
                            <div class="center-div">
                            <h1>Title of paragraph</h1>
                            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus
                            vestibulum augue ut aliquet. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum.
                            Sed dapibus pulvinar nibh tempor porta.</p>
                            </div>
                            </div>
                            <div>
                            <div class="myButton">
                            <a target="_blank" href="" class="btn btn-primary" style="text-decoration:none;">Explore More »</a>
                            </div>
                            </div>





                             .center-div {
                            border: 3px solid red;
                            background-color: peachpuff;
                            text-align: center;
                            margin: 10px;
                            }

                            .logo {
                            text-align: center;
                            }

                            .myButton {
                            text-align: center;
                            }

                              <div>
                            <div class="logo">
                            <h1>Logo</h1>
                            </div>
                            </div>
                            <div>
                            <div class="center-div">
                            <h1>Title of paragraph</h1>
                            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus
                            vestibulum augue ut aliquet. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum.
                            Sed dapibus pulvinar nibh tempor porta.</p>
                            </div>
                            </div>
                            <div>
                            <div class="myButton">
                            <a target="_blank" href="" class="btn btn-primary" style="text-decoration:none;">Explore More »</a>
                            </div>
                            </div>






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Dec 23 '18 at 18:57

























                            answered Nov 24 '18 at 21:17









                            Alex LeoAlex Leo

                            7771213




                            7771213























                                -1














                                Just remove the "position" and "transform" attribute from the ".center-div" styling!! Then remove the "text-align" & add some "padding-left" to the button.. I hope it'll work:)






                                share|improve this answer




























                                  -1














                                  Just remove the "position" and "transform" attribute from the ".center-div" styling!! Then remove the "text-align" & add some "padding-left" to the button.. I hope it'll work:)






                                  share|improve this answer


























                                    -1












                                    -1








                                    -1







                                    Just remove the "position" and "transform" attribute from the ".center-div" styling!! Then remove the "text-align" & add some "padding-left" to the button.. I hope it'll work:)






                                    share|improve this answer













                                    Just remove the "position" and "transform" attribute from the ".center-div" styling!! Then remove the "text-align" & add some "padding-left" to the button.. I hope it'll work:)







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Nov 24 '18 at 18:52









                                    Madhubala JayakumaranMadhubala Jayakumaran

                                    43




                                    43






























                                        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.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53458303%2fwant-to-put-button-below-vertically-centered-div%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

                                        Costa Masnaga

                                        Fotorealismo

                                        Sidney Franklin