我目前在使用最新版本的bootstrap 3.0.0
问题很简单。在我使用的jumbotron容器中,我如何使文本与标志居中对齐?
我已经尝试了几个小时,使用col-md-*,但运气不佳。
在bootstrap 2.3.2中,我通过使用.text-center
和.pagination center
(用于图片? - 它起作用了)来实现将所有内容居中对齐。
这个fiddle演示了我正在尝试在bootstrap 3.0.0中居中对齐的文本和图像。
我目前在使用最新版本的bootstrap 3.0.0
问题很简单。在我使用的jumbotron容器中,我如何使文本与标志居中对齐?
我已经尝试了几个小时,使用col-md-*,但运气不佳。
在bootstrap 2.3.2中,我通过使用.text-center
和.pagination center
(用于图片? - 它起作用了)来实现将所有内容居中对齐。
这个fiddle演示了我正在尝试在bootstrap 3.0.0中居中对齐的文本和图像。
<div class="jumbotron">
<div class="container">
<div class="row well well-lg">
<div class="col-md-6 col-md-offset-3">
<h1 class="">Home of the</h1>
<div class="">
<img src="http://www.harrogatepoker.co.uk/profile/HPL%20V%20Logo%20%20Revised%20and%20Further%20reduced.jpg" class="img-responsive text-center" />
</div>
<h2 class="">"All In", Fun!</h2>
</div>
</div>
</div>
Bootstrap提供了一个12列网格系统,如果你的主要列使用了6列,你可以将其偏移3列,这样会留下:
3列 6列(主容器) 3列
<head>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<style>
.centerfy img{
margin: 0 auto;
}
.centerfy{
text-align: center;
}
</style>
</head>
<body style=" padding: 10px;">
<div class="jumbotron">
<div class="container">
<div class="row well well-lg">
<div class="col-md-6 col-md-offset-3 centerfy">
<h1 class="">Home of the</h1>
<div class="">
<img src="http://www.harrogatepoker.co.uk/profile/HPL%20V%20Logo%20%20Revised%20and%20Further%20reduced.jpg" class="img-responsive text-center" />
</div>
<h2 class="">"All In", Fun!</h2>
</div>
</div>
</div>
</body>
请查看我添加的类。
<div class="jumbotron">
<div class="container text-center">
<h1>Hello World</h1>
<img src="http://klpgo.com/klpfiles/images/klpgov3.png" alt="img" class="img-responsive center-block">
<p>custom text within my jumbotron</p>
<a class="btn btn-default">first button</a>
<a class="btn btn-info">second button</a>
</div>
</div>