热门关键字:
jquery > jquery教程 > jquery教程 > 如何在Bootstrap中获取居中内容

如何在Bootstrap中获取居中内容

383
作者:管理员
发布时间:2021/2/8 14:25:54
评论数:0
转载请自觉注明原文:http://www.jq-school.com/Show.aspx?id=3962
答:使用text-center课程
您可以简单地使用Bootstrap的内置类.text-center来将所有内联元素(如文本,图像,链接等)居中对齐在诸如a<div>或<p>element之类的块元素内。


此解决方案在Bootstrap 3和Bootstrap 4版本中均可使用。这是一个例子:


例试试这个代码»
-<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Text Centering in Bootstrap</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery-3.5.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</head> 
<body>
    <div class="container">
        <div class="row">
            <div class="col-lg-12 text-center">
                <h1>This is a heading</h1>
                <p>This is simple paragraph of text.</p>
            </div>
        </div>
    </div>
</body>
</html>




如果您觉得本文的内容对您的学习有所帮助:支付鼓励



关键字:jQuery
友荐云推荐