flexbox justify-content multiple tags underneath eachother [duplicate]












-1
















This question already has an answer here:




  • Flexbox: center horizontally and vertically

    10 answers




I have a div with a h1 and h2 tag in it, my goal is to center them horizontally and vertically I am using flexbox but this is how my code acts



 --------------
| |
| h1h2 |
| |
--------------


my goal is this



 --------------
| |
| h1 |
| h2 |
| |
--------------


my html:



<div class="announcement">
<h1>h1</h1>
<h2>h2</h2>
</div>


my css:



.announcement {
display: flex;
align-items: center;
justify-content: center;
}


I've tried doing a <br> after the <h1> but doesnt do anyhting










share|improve this question















marked as duplicate by Temani Afif css
Users with the  css badge can single-handedly close css questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 25 '18 at 12:54


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.























    -1
















    This question already has an answer here:




    • Flexbox: center horizontally and vertically

      10 answers




    I have a div with a h1 and h2 tag in it, my goal is to center them horizontally and vertically I am using flexbox but this is how my code acts



     --------------
    | |
    | h1h2 |
    | |
    --------------


    my goal is this



     --------------
    | |
    | h1 |
    | h2 |
    | |
    --------------


    my html:



    <div class="announcement">
    <h1>h1</h1>
    <h2>h2</h2>
    </div>


    my css:



    .announcement {
    display: flex;
    align-items: center;
    justify-content: center;
    }


    I've tried doing a <br> after the <h1> but doesnt do anyhting










    share|improve this question















    marked as duplicate by Temani Afif css
    Users with the  css badge can single-handedly close css questions as duplicates and reopen them as needed.

    StackExchange.ready(function() {
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function() {
    $hover.showInfoMessage('', {
    messageElement: $msg.clone().show(),
    transient: false,
    position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
    dismissable: false,
    relativeToBody: true
    });
    },
    function() {
    StackExchange.helpers.removeMessages();
    }
    );
    });
    });
    Nov 25 '18 at 12:54


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





















      -1












      -1








      -1









      This question already has an answer here:




      • Flexbox: center horizontally and vertically

        10 answers




      I have a div with a h1 and h2 tag in it, my goal is to center them horizontally and vertically I am using flexbox but this is how my code acts



       --------------
      | |
      | h1h2 |
      | |
      --------------


      my goal is this



       --------------
      | |
      | h1 |
      | h2 |
      | |
      --------------


      my html:



      <div class="announcement">
      <h1>h1</h1>
      <h2>h2</h2>
      </div>


      my css:



      .announcement {
      display: flex;
      align-items: center;
      justify-content: center;
      }


      I've tried doing a <br> after the <h1> but doesnt do anyhting










      share|improve this question

















      This question already has an answer here:




      • Flexbox: center horizontally and vertically

        10 answers




      I have a div with a h1 and h2 tag in it, my goal is to center them horizontally and vertically I am using flexbox but this is how my code acts



       --------------
      | |
      | h1h2 |
      | |
      --------------


      my goal is this



       --------------
      | |
      | h1 |
      | h2 |
      | |
      --------------


      my html:



      <div class="announcement">
      <h1>h1</h1>
      <h2>h2</h2>
      </div>


      my css:



      .announcement {
      display: flex;
      align-items: center;
      justify-content: center;
      }


      I've tried doing a <br> after the <h1> but doesnt do anyhting





      This question already has an answer here:




      • Flexbox: center horizontally and vertically

        10 answers








      html css flexbox






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 25 '18 at 14:02









      Yashwardhan Pauranik

      2,06111629




      2,06111629










      asked Nov 25 '18 at 12:49









      Miklo VubaMiklo Vuba

      32




      32




      marked as duplicate by Temani Afif css
      Users with the  css badge can single-handedly close css questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Nov 25 '18 at 12:54


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









      marked as duplicate by Temani Afif css
      Users with the  css badge can single-handedly close css questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Nov 25 '18 at 12:54


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


























          1 Answer
          1






          active

          oldest

          votes


















          1














          Give flex-direction: column;. As by default, the flex layout is direction is row



          .announcement {
          display: flex;
          align-items: center;
          justify-content: center;
          flex-direction: column;
          }





          share|improve this answer



















          • 1





            Awesome! Thank you very much!

            – Miklo Vuba
            Nov 25 '18 at 13:01











          • @MikloVuba Welcome, Please accept the answer also.

            – Yashwardhan Pauranik
            Nov 25 '18 at 13:02


















          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Give flex-direction: column;. As by default, the flex layout is direction is row



          .announcement {
          display: flex;
          align-items: center;
          justify-content: center;
          flex-direction: column;
          }





          share|improve this answer



















          • 1





            Awesome! Thank you very much!

            – Miklo Vuba
            Nov 25 '18 at 13:01











          • @MikloVuba Welcome, Please accept the answer also.

            – Yashwardhan Pauranik
            Nov 25 '18 at 13:02
















          1














          Give flex-direction: column;. As by default, the flex layout is direction is row



          .announcement {
          display: flex;
          align-items: center;
          justify-content: center;
          flex-direction: column;
          }





          share|improve this answer



















          • 1





            Awesome! Thank you very much!

            – Miklo Vuba
            Nov 25 '18 at 13:01











          • @MikloVuba Welcome, Please accept the answer also.

            – Yashwardhan Pauranik
            Nov 25 '18 at 13:02














          1












          1








          1







          Give flex-direction: column;. As by default, the flex layout is direction is row



          .announcement {
          display: flex;
          align-items: center;
          justify-content: center;
          flex-direction: column;
          }





          share|improve this answer













          Give flex-direction: column;. As by default, the flex layout is direction is row



          .announcement {
          display: flex;
          align-items: center;
          justify-content: center;
          flex-direction: column;
          }






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 25 '18 at 12:53









          Yashwardhan PauranikYashwardhan Pauranik

          2,06111629




          2,06111629








          • 1





            Awesome! Thank you very much!

            – Miklo Vuba
            Nov 25 '18 at 13:01











          • @MikloVuba Welcome, Please accept the answer also.

            – Yashwardhan Pauranik
            Nov 25 '18 at 13:02














          • 1





            Awesome! Thank you very much!

            – Miklo Vuba
            Nov 25 '18 at 13:01











          • @MikloVuba Welcome, Please accept the answer also.

            – Yashwardhan Pauranik
            Nov 25 '18 at 13:02








          1




          1





          Awesome! Thank you very much!

          – Miklo Vuba
          Nov 25 '18 at 13:01





          Awesome! Thank you very much!

          – Miklo Vuba
          Nov 25 '18 at 13:01













          @MikloVuba Welcome, Please accept the answer also.

          – Yashwardhan Pauranik
          Nov 25 '18 at 13:02





          @MikloVuba Welcome, Please accept the answer also.

          – Yashwardhan Pauranik
          Nov 25 '18 at 13:02





          Popular posts from this blog

          Tonle Sap (See)

          I get strange results when I access the Sqlitedatabase with Unity C# via XAMPP

          Guatemaltekische Davis-Cup-Mannschaft