나한테 '클래스' 에서 센터 블록 것 같다고 누락되었는지 부트스트랩이 3 스타일 시트. 내가 무언가 빠진?
<! - begin 스니핏: js 숨기십시오: 거짓값 콘솔: 진정한 바벨. > 거짓값 -;
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="center-block" style="width:200px;background-color:#ccc;">...</div>
</div>
끝 - < 스니핏 >;!
작동하잖아) 보다 훨씬 this way (보존 응답성의):
<!-- somewhere deep start -->
<div class="row">
<div class="center-block col-md-4" style="float: none; background-color: grey">
Hi there!
</div>
</div>
<!-- somewhere deep end -->
여기에 대답을 몇 불완전한 것으로 보인다. 다음은 몇 가지 변경:
<style>
.box {
height: 200px;
width: 200px;
border: 4px solid gray;
}
</style>
<!-- This works: .container>.row>.center-block.box -->
<div class="container">
<div class="row">
<div class="center-block bg-primary box">This div is centered with .center-block</div>
</div>
</div>
<!-- This does not work -->
<div class="container">
<div class="row">
<div class="center-block bg-primary box col-xs-4">This div is centered with .center-block</div>
</div>
</div>
<!-- This is the hybrid solution from other answers:
.container>.row>.col-xs-6>.center-block.box
-->
<div class="container">
<div class="row">
<div class="col-xs-6 bg-info">
<div class="center-block bg-primary box">This div is centered with .center-block</div>
</div>
</div>
</div>
이를 위해 col- 작동합니까 클래스뿐만 .col- 내에 있지만, 반드시 필요한 .center-block 잡기, 다른 클래스를 설정할 수 있는 클래스 추가하거나 너비입니다 (이상자 이 경우), 또는 그 자체가 변경하십시오 .center-block 제공하여 너비입니다.
부테플리 에서 체크아웃합니다.