À̹ÌÁö¿Í ÅؽºÆ®¸¦ ȸé Áß¾Ó¿¡ ¹èÄ¡ÇØ º¸ÀÚ. * ÅؽºÆ® Áß¾Ó¿¡ ¹èÄ¡ display: flex;
flex-direction: row; justify-content: center; align-items: center; * À̹ÌÁö Áß¾Ó¿¡ ¹èÄ¡ .absolute-center {
position: absolute; overflow: auto; /* Recommended in case content is larger than the container */ margin: auto; /* this is essential */ top: 0; left: 0; bottom: 0; right: 0; /* this is essential */ } * Àüü ÄÚµå <!DOCTYPE html>
<html> <head> <style> #myimage { position: absolute; width: 500px; height: 500px; border: 1px solid green; background-image:url('grass.jpg'); background-repeat:no-repeat; background-size: 100% 100%; /*center text*/ display: flex; flex-direction: row; justify-content: center; align-items: center; } .absolute-center { position: absolute; overflow: auto; /* Recommended in case content is larger than the container */ margin: auto; /* this is essential */ top: 0; left: 0; bottom: 0; right: 0; /* this is essential */ color : red; } </style> </head> <body> <div class="absolute-center" id="myimage">¾Æ¸§´Ù¿î ¿ì¸®³ª¶ó, ¿ì¸®ÀÇ ¼Ò¿øÀº ÅëÀÏ</div> </body> </html> Å×½ºÆ® : center_object.html Âü°í) https://ctrlq.org/code/19623-absolute-center-css |