简体   繁体   English

水平和垂直居中 bootstrap div 中的 div(ASP.NET)

[英]Center div in bootstrap div horizontally and vertically(ASP.NET)

I have div with bootstrap class Here is code我有带有引导程序类的 div 这是代码

  <div class="col-lg-12">
                <div style="text-align: center; width: 50%; font-size: 20px; display: inline-block; position: absolute;top: 0;left: 0;bottom: 0;right: 0;margin: auto;">
                        <p>
                            The latest offered radiology management systems are capable of helping the radiologists to provide exacting digital images and data. Viewing different types of images from various examinations is very convenient with this particular software. Through multiple viewing processes, it is possible to view the images while other people are seeing them. Viewing the imagery is satisfying because of the impressive features of the software.
                        </p>
                    </div>
               </div>

I need to center this div vertically and horizontally我需要将这个 div 垂直和水平居中

<div style="text-align: center; width: 50%; font-size: 20px; display: inline-block; position: absolute;top: 0;left: 0;bottom: 0;right: 0;margin: auto;">

I try with this style我尝试这种风格

style="text-align: center; width: 50%; font-size: 20px; display: inline-block; position: absolute;top: 0;left: 0;bottom: 0;right: 0;margin: auto;"

But it not centering vertically, only horizontally.但它不是垂直居中,而是水平居中。

Where is my mistake?我的错误在哪里?

Give this code a try:试试这段代码:

 <div class="col-lg-12">
  <div style="text-align: center;min-width: 50%;max-width:100%; font-size: 20px; display: inline-block; top: 0;left: 0;bottom: 0;right: 0;position: absolute;margin:30%;">
   <p>
    The latest offered radiology management systems are capable of helping the radiologists to provide exacting digital images and data. Viewing different types of images from various examinations is very convenient with this particular software. Through multiple viewing processes, it is possible to view the images while other people are seeing them. Viewing the imagery is satisfying because of the impressive features of the software.
   </p>
  </div>
 </div>
<div class="col-lg-12">
        <div style="text-align: center;min-width: 50%;max-width:100%; font-size: 20px; display: inline-block; top: 0;left: 0;bottom: 0;right: 0;position: absolute; margin-top:20%; margin-bottom:20% ">
           <p>
                The latest offered radiology management systems are capable of helping the radiologists to provide exacting digital images and data. Viewing different types of images from various examinations is very convenient with this particular software. Through multiple viewing processes, it is possible to view the images while other people are seeing them. Viewing the imagery is satisfying because of the impressive features of the software.
            </p>
        </div>
    </div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM