javascript - Responsive centered Popup that fits his Content -


i'm trying last couple hours responsive box centered , automatically shrinks contents.

i can't figure out how work.

i'm using this:

display: inline-block;  

this way fit contents , align popup in center :

text-align: center; 

but can't figure out how responsive.

edited :

sorry code missing! here :

<!doctype html> <html>  <head>     <meta charset="utf-8">     <style type="text/css">         .modalwrapper {             width: 100%;             height: 100%;             position: fixed;             text-align: center;         }         .modalpopup {             background: #ffffff;             border-radius: 5px;             display: inline-block;             border: solid thin #19b4b5;         }         .modaltop {             text-align: center !important;             width: 100%;             height: 30%;             min-height: 30%;             padding-top: 5%;             padding-bottom: 5%;             top: 0px;             left: 0px;             background-color: #19b4b5;         }         .modalcontent {             display: inline-block;             margin: 10px;         }     </style> </head>  <body>     <div id="fb-root"></div>     <script language="javascript" type="text/javascript">         (function(d, s, id) {             var js, fjs = d.getelementsbytagname(s)[0];             if (d.getelementbyid(id)) return;             js = d.createelement(s);             js.id = id;             js.src = "//connect.facebook.net/de_de/sdk.js#xfbml=1&version=v2.8";             fjs.parentnode.insertbefore(js, fjs);         }(document, 'script', 'facebook-jssdk'));     </script>     <div class="modalwrapper">         <div class="modalpopup">             <div class="modaltop">your post</div>             <div class="modalcontent">                 <div class="fb-post" data-href="https://www.facebook.com/20531316728/posts/10154009990506729/" data-show-text="true">                     <blockquote cite="https://www.facebook.com/20531316728/posts/10154009990506729/" class="fb-xfbml-parse-ignore"></blockquote>                 </div>             </div>         </div>     </div> </body>  </html> 

this not optimized yet , i´m total newbie web development.

thanks lot time , help!

you can use bootstrap add responsiveness. it's little cumbersome html works , easy use. download bootstrap here:

http://getbootstrap.com/

then implement wrapping pop-up inside "row" div:

<div class="row">

and div specifies size, example:

<div class="col-md-4">

different sizes , layouts of grids allow flexibility determine how responsive want be.

you can see many examples of how use bootstrap's grids here:

http://getbootstrap.com/examples/grid/


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -