Auto sizing div [duplicate] The Next CEO of Stack OverflowHow to horizontally center a <div>?How to vertically center a div for all browsers?Flexbox: center horizontally and verticallyMake a div fill the height of the remaining screen spaceHow to horizontally center a <div>?How to make div not larger than its contents?How to align content of a div to the bottom?Creating a div element in jQueryHow to make a div 100% height of the browser window?How do I auto-resize an image to fit a 'div' container?How can I transition height: 0; to height: auto; using CSS?Click through div to underlying elementsCreating a two-column-100% layout with Bootstrap

Some questions about different axiomatic systems for neighbourhoods

Why do remote US companies require working in the US?

Make solar eclipses exceedingly rare, but still have new moons

Why the difference in type-inference over the as-pattern in two similar function definitions?

Why is quantifier elimination desirable for a given theory?

Unclear about dynamic binding

Do I need to write [sic] when a number is less than 10 but isn't written out?

Flying from Cape Town to England and return to another province

What did we know about the Kessel run before the prequels?

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

Math-accent symbol over parentheses enclosing accented symbol (amsmath)

How to invert MapIndexed on a ragged structure? How to construct a tree from rules?

Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?

The exact meaning of 'Mom made me a sandwich'

I want to delete every two lines after 3rd lines in file contain very large number of lines :

Is it ever safe to open a suspicious HTML file (e.g. email attachment)?

Axiom Schema vs Axiom

Why is my new battery behaving weirdly?

Is it my responsibility to learn a new technology in my own time my employer wants to implement?

Is there a way to save my career from absolute disaster?

Why isn't acceleration always zero whenever velocity is zero, such as the moment a ball bounces off a wall?

Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?

Is it professional to write unrelated content in an almost-empty email?

How to count occurrences of text in a file?



Auto sizing div [duplicate]



The Next CEO of Stack OverflowHow to horizontally center a <div>?How to vertically center a div for all browsers?Flexbox: center horizontally and verticallyMake a div fill the height of the remaining screen spaceHow to horizontally center a <div>?How to make div not larger than its contents?How to align content of a div to the bottom?Creating a div element in jQueryHow to make a div 100% height of the browser window?How do I auto-resize an image to fit a 'div' container?How can I transition height: 0; to height: auto; using CSS?Click through div to underlying elementsCreating a two-column-100% layout with Bootstrap










-2
















This question already has an answer here:



  • Flexbox: center horizontally and vertically

    10 answers



  • How to horizontally center a <div>?

    95 answers



  • How to vertically center a div for all browsers?

    41 answers



On most of my sites, I put information into a div that has rounded corners with a fox shadow. I was wondering if there is a way to have this parent div automatically center itself vertically & horizontally while changing its height & width based on its children. Below is as close as I have gotten but the div stays to the upper left of my page. It seems to fit the content well but the position is not close to where I'd want it.



.appRoundedShadow 
display: inline-block;
justify-content: center;
align-items: center;
height: auto;
width: auto;
background-color: white;
padding: 25px;
border-radius: 20px;
border: 1px outset gray;
box-shadow: 10px 10px 5px #888888;



I haven't been successful with flexbox.










share|improve this question















marked as duplicate by Rob, 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();

);
);
);
Mar 8 at 19:42


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.






















    -2
















    This question already has an answer here:



    • Flexbox: center horizontally and vertically

      10 answers



    • How to horizontally center a <div>?

      95 answers



    • How to vertically center a div for all browsers?

      41 answers



    On most of my sites, I put information into a div that has rounded corners with a fox shadow. I was wondering if there is a way to have this parent div automatically center itself vertically & horizontally while changing its height & width based on its children. Below is as close as I have gotten but the div stays to the upper left of my page. It seems to fit the content well but the position is not close to where I'd want it.



    .appRoundedShadow 
    display: inline-block;
    justify-content: center;
    align-items: center;
    height: auto;
    width: auto;
    background-color: white;
    padding: 25px;
    border-radius: 20px;
    border: 1px outset gray;
    box-shadow: 10px 10px 5px #888888;



    I haven't been successful with flexbox.










    share|improve this question















    marked as duplicate by Rob, 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();

    );
    );
    );
    Mar 8 at 19:42


    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.




















      -2












      -2








      -2









      This question already has an answer here:



      • Flexbox: center horizontally and vertically

        10 answers



      • How to horizontally center a <div>?

        95 answers



      • How to vertically center a div for all browsers?

        41 answers



      On most of my sites, I put information into a div that has rounded corners with a fox shadow. I was wondering if there is a way to have this parent div automatically center itself vertically & horizontally while changing its height & width based on its children. Below is as close as I have gotten but the div stays to the upper left of my page. It seems to fit the content well but the position is not close to where I'd want it.



      .appRoundedShadow 
      display: inline-block;
      justify-content: center;
      align-items: center;
      height: auto;
      width: auto;
      background-color: white;
      padding: 25px;
      border-radius: 20px;
      border: 1px outset gray;
      box-shadow: 10px 10px 5px #888888;



      I haven't been successful with flexbox.










      share|improve this question

















      This question already has an answer here:



      • Flexbox: center horizontally and vertically

        10 answers



      • How to horizontally center a <div>?

        95 answers



      • How to vertically center a div for all browsers?

        41 answers



      On most of my sites, I put information into a div that has rounded corners with a fox shadow. I was wondering if there is a way to have this parent div automatically center itself vertically & horizontally while changing its height & width based on its children. Below is as close as I have gotten but the div stays to the upper left of my page. It seems to fit the content well but the position is not close to where I'd want it.



      .appRoundedShadow 
      display: inline-block;
      justify-content: center;
      align-items: center;
      height: auto;
      width: auto;
      background-color: white;
      padding: 25px;
      border-radius: 20px;
      border: 1px outset gray;
      box-shadow: 10px 10px 5px #888888;



      I haven't been successful with flexbox.





      This question already has an answer here:



      • Flexbox: center horizontally and vertically

        10 answers



      • How to horizontally center a <div>?

        95 answers



      • How to vertically center a div for all browsers?

        41 answers







      html css






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 at 17:00









      Kaspar Lee

      3,74611746




      3,74611746










      asked Mar 8 at 15:47









      crmckaincrmckain

      987




      987




      marked as duplicate by Rob, 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();

      );
      );
      );
      Mar 8 at 19:42


      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 Rob, 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();

      );
      );
      );
      Mar 8 at 19:42


      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.
























          2 Answers
          2






          active

          oldest

          votes


















          1














          flexbox should be the solution for your problem, read more about CSS flexbox here






          html,body
          width:100%;
          height:100%;
          margin:0;

          .appRoundedShadow
          display: inline-block;
          height: auto;
          width: auto;
          background-color: white;
          padding: 25px;
          border-radius: 20px;
          border: 1px outset gray;
          box-shadow: 10px 10px 5px #888888;

          .container
          width:100%;
          height:100%;
          display:flex;
          justify-content:center;
          align-items:center;

          <div class="container">
          <div class="appRoundedShadow">Some Text</div>
          </div>








          share|improve this answer























          • Why are you moving a new container tag instead of the stylized tag ? Also, width:100% is the default value

            – Arthur
            Mar 8 at 16:06











          • Just explaining the idea

            – xTrimy
            Mar 8 at 16:08


















          2














          Using flex is easy. The think you must not forget is:
          The child is vertically centered on the parent height. So you must set a minimum to works or height of parent is equal to child height (and no top/bottom margin are required to center it)






          /* Normalize */
          html, body
          padding: 0;
          margin: 0;

          html
          height: 100%;

          body
          min-height: 100%;
          display: flex;

          .appRoundedShadow
          margin:auto;

          background-color: white;
          padding: 25px;
          border-radius: 20px;
          border: 1px outset gray;
          box-shadow: 10px 10px 5px #888888;

          <div class="appRoundedShadow"></div>








          share|improve this answer





























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            flexbox should be the solution for your problem, read more about CSS flexbox here






            html,body
            width:100%;
            height:100%;
            margin:0;

            .appRoundedShadow
            display: inline-block;
            height: auto;
            width: auto;
            background-color: white;
            padding: 25px;
            border-radius: 20px;
            border: 1px outset gray;
            box-shadow: 10px 10px 5px #888888;

            .container
            width:100%;
            height:100%;
            display:flex;
            justify-content:center;
            align-items:center;

            <div class="container">
            <div class="appRoundedShadow">Some Text</div>
            </div>








            share|improve this answer























            • Why are you moving a new container tag instead of the stylized tag ? Also, width:100% is the default value

              – Arthur
              Mar 8 at 16:06











            • Just explaining the idea

              – xTrimy
              Mar 8 at 16:08















            1














            flexbox should be the solution for your problem, read more about CSS flexbox here






            html,body
            width:100%;
            height:100%;
            margin:0;

            .appRoundedShadow
            display: inline-block;
            height: auto;
            width: auto;
            background-color: white;
            padding: 25px;
            border-radius: 20px;
            border: 1px outset gray;
            box-shadow: 10px 10px 5px #888888;

            .container
            width:100%;
            height:100%;
            display:flex;
            justify-content:center;
            align-items:center;

            <div class="container">
            <div class="appRoundedShadow">Some Text</div>
            </div>








            share|improve this answer























            • Why are you moving a new container tag instead of the stylized tag ? Also, width:100% is the default value

              – Arthur
              Mar 8 at 16:06











            • Just explaining the idea

              – xTrimy
              Mar 8 at 16:08













            1












            1








            1







            flexbox should be the solution for your problem, read more about CSS flexbox here






            html,body
            width:100%;
            height:100%;
            margin:0;

            .appRoundedShadow
            display: inline-block;
            height: auto;
            width: auto;
            background-color: white;
            padding: 25px;
            border-radius: 20px;
            border: 1px outset gray;
            box-shadow: 10px 10px 5px #888888;

            .container
            width:100%;
            height:100%;
            display:flex;
            justify-content:center;
            align-items:center;

            <div class="container">
            <div class="appRoundedShadow">Some Text</div>
            </div>








            share|improve this answer













            flexbox should be the solution for your problem, read more about CSS flexbox here






            html,body
            width:100%;
            height:100%;
            margin:0;

            .appRoundedShadow
            display: inline-block;
            height: auto;
            width: auto;
            background-color: white;
            padding: 25px;
            border-radius: 20px;
            border: 1px outset gray;
            box-shadow: 10px 10px 5px #888888;

            .container
            width:100%;
            height:100%;
            display:flex;
            justify-content:center;
            align-items:center;

            <div class="container">
            <div class="appRoundedShadow">Some Text</div>
            </div>








            html,body
            width:100%;
            height:100%;
            margin:0;

            .appRoundedShadow
            display: inline-block;
            height: auto;
            width: auto;
            background-color: white;
            padding: 25px;
            border-radius: 20px;
            border: 1px outset gray;
            box-shadow: 10px 10px 5px #888888;

            .container
            width:100%;
            height:100%;
            display:flex;
            justify-content:center;
            align-items:center;

            <div class="container">
            <div class="appRoundedShadow">Some Text</div>
            </div>





            html,body
            width:100%;
            height:100%;
            margin:0;

            .appRoundedShadow
            display: inline-block;
            height: auto;
            width: auto;
            background-color: white;
            padding: 25px;
            border-radius: 20px;
            border: 1px outset gray;
            box-shadow: 10px 10px 5px #888888;

            .container
            width:100%;
            height:100%;
            display:flex;
            justify-content:center;
            align-items:center;

            <div class="container">
            <div class="appRoundedShadow">Some Text</div>
            </div>






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 8 at 15:59









            xTrimyxTrimy

            13112




            13112












            • Why are you moving a new container tag instead of the stylized tag ? Also, width:100% is the default value

              – Arthur
              Mar 8 at 16:06











            • Just explaining the idea

              – xTrimy
              Mar 8 at 16:08

















            • Why are you moving a new container tag instead of the stylized tag ? Also, width:100% is the default value

              – Arthur
              Mar 8 at 16:06











            • Just explaining the idea

              – xTrimy
              Mar 8 at 16:08
















            Why are you moving a new container tag instead of the stylized tag ? Also, width:100% is the default value

            – Arthur
            Mar 8 at 16:06





            Why are you moving a new container tag instead of the stylized tag ? Also, width:100% is the default value

            – Arthur
            Mar 8 at 16:06













            Just explaining the idea

            – xTrimy
            Mar 8 at 16:08





            Just explaining the idea

            – xTrimy
            Mar 8 at 16:08













            2














            Using flex is easy. The think you must not forget is:
            The child is vertically centered on the parent height. So you must set a minimum to works or height of parent is equal to child height (and no top/bottom margin are required to center it)






            /* Normalize */
            html, body
            padding: 0;
            margin: 0;

            html
            height: 100%;

            body
            min-height: 100%;
            display: flex;

            .appRoundedShadow
            margin:auto;

            background-color: white;
            padding: 25px;
            border-radius: 20px;
            border: 1px outset gray;
            box-shadow: 10px 10px 5px #888888;

            <div class="appRoundedShadow"></div>








            share|improve this answer



























              2














              Using flex is easy. The think you must not forget is:
              The child is vertically centered on the parent height. So you must set a minimum to works or height of parent is equal to child height (and no top/bottom margin are required to center it)






              /* Normalize */
              html, body
              padding: 0;
              margin: 0;

              html
              height: 100%;

              body
              min-height: 100%;
              display: flex;

              .appRoundedShadow
              margin:auto;

              background-color: white;
              padding: 25px;
              border-radius: 20px;
              border: 1px outset gray;
              box-shadow: 10px 10px 5px #888888;

              <div class="appRoundedShadow"></div>








              share|improve this answer

























                2












                2








                2







                Using flex is easy. The think you must not forget is:
                The child is vertically centered on the parent height. So you must set a minimum to works or height of parent is equal to child height (and no top/bottom margin are required to center it)






                /* Normalize */
                html, body
                padding: 0;
                margin: 0;

                html
                height: 100%;

                body
                min-height: 100%;
                display: flex;

                .appRoundedShadow
                margin:auto;

                background-color: white;
                padding: 25px;
                border-radius: 20px;
                border: 1px outset gray;
                box-shadow: 10px 10px 5px #888888;

                <div class="appRoundedShadow"></div>








                share|improve this answer













                Using flex is easy. The think you must not forget is:
                The child is vertically centered on the parent height. So you must set a minimum to works or height of parent is equal to child height (and no top/bottom margin are required to center it)






                /* Normalize */
                html, body
                padding: 0;
                margin: 0;

                html
                height: 100%;

                body
                min-height: 100%;
                display: flex;

                .appRoundedShadow
                margin:auto;

                background-color: white;
                padding: 25px;
                border-radius: 20px;
                border: 1px outset gray;
                box-shadow: 10px 10px 5px #888888;

                <div class="appRoundedShadow"></div>








                /* Normalize */
                html, body
                padding: 0;
                margin: 0;

                html
                height: 100%;

                body
                min-height: 100%;
                display: flex;

                .appRoundedShadow
                margin:auto;

                background-color: white;
                padding: 25px;
                border-radius: 20px;
                border: 1px outset gray;
                box-shadow: 10px 10px 5px #888888;

                <div class="appRoundedShadow"></div>





                /* Normalize */
                html, body
                padding: 0;
                margin: 0;

                html
                height: 100%;

                body
                min-height: 100%;
                display: flex;

                .appRoundedShadow
                margin:auto;

                background-color: white;
                padding: 25px;
                border-radius: 20px;
                border: 1px outset gray;
                box-shadow: 10px 10px 5px #888888;

                <div class="appRoundedShadow"></div>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 8 at 15:54









                ArthurArthur

                2,91531838




                2,91531838













                    Popular posts from this blog

                    Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

                    Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

                    2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived