부트 스트랩을 사용하여 버튼 사이에 간격을주는 방법
버튼 사이의 간격을 지정하고 싶습니다. 부트 스트랩을 사용하여 간격을 지정하여 다른 화면 해상도에서 일관되게 유지하는 방법이 있습니다.
나는 사용해 보았지만 margin-left
이것을하는 올바른 방법입니까. ??
다음은 데모입니다.
HTML :
<div class="btn-toolbar text-center well">
<button type="button" class="btn btn-primary btn-color btn-bg-color btn-sm col-xs-2 margin-left">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> ADD PACKET
</button>
<button type="button" class="btn btn-primary btn-color btn-bg-color btn-sm col-xs-2 margin-left">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span> EDIT CUSTOMER
</button>
<button type="button" class="btn btn-primary btn-color btn-bg-color btn-sm col-xs-2 margin-left">
<span class="glyphicon glyphicon-time" aria-hidden="true"></span> HISTORY
</button>
<button type="button" class="btn btn-primary btn-color btn-bg-color btn-sm col-xs-2 margin-left">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> DELETE CUSTOMER
</button>
</div>
CSS :
.margin-left{
margin-left: 80px !important;
}
HTML :
<input id="id_ok" class="btn btn-space" value="OK" type="button">
<input id="id_cancel" class="btn btn-space" value="Cancel" type="button">
CSS :
.btn-space {
margin-right: 5px;
}
부트 스트랩 간격 을 사용하여 얻을 수 있습니다 . Bootstrap Spacing에는 다양한 속기 반응 여백 및 패딩이 포함됩니다. 예를 하회 mr-1
설정 margin
또는 padding
행 $spacer
* 0.25.
예 :
<button class="btn btn-outline-primary mr-1" href="#">Sign up</button>
<button class="btn btn-outline-primary" href="#">Login</button>
Bootstrap Spacing 에서 더 많은 것을 읽을 수 있습니다 .
class='col-xs-3'
예를 들어 버튼을 div로 감싸십시오 .class="btn-block"
버튼에 추가 하십시오.
이것은 영구적 인 간격을 제공합니다.
여백을 사용하려면 모든 버튼에서 클래스를 제거하고 : last-child CSS 선택기를 사용하십시오.
HTML :
<div class="btn-toolbar text-center well">
<button type="button" class="btn btn-primary btn-color btn-bg-color btn-sm col-xs-2">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> ADD PACKET
</button>
<button type="button" class="btn btn-primary btn-color btn-bg-color btn-sm col-xs-2">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span> EDIT CUSTOMER
</button>
<button type="button" class="btn btn-primary btn-color btn-bg-color btn-sm col-xs-2">
<span class="glyphicon glyphicon-time" aria-hidden="true"></span> HISTORY
</button>
<button type="button" class="btn btn-primary btn-color btn-bg-color btn-sm col-xs-2">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> DELETE CUSTOMER
</button>
</div>
CSS :
.btn-toolbar .btn{
margin-right: 5px;
}
.btn-toolbar .btn:last-child{
margin-right: 0;
}
원하는 공간에 따라 다릅니다. 각 항목 사이에 "col-XX-1"을 추가하는 논리에 동의하는지 모르겠습니다. 그러면 각 항목 사이에 전체 "열"을 정의하기 때문입니다.
각 버튼 사이에 "약간 간격"을두고 싶으면 둘러싼 행에 패딩을 추가하는 것을 좋아합니다. 이렇게하면 각 버튼 사이에 "공백"을 포함시키면서 12 개의 열을 모두 사용할 수 있습니다.
Bootply : http://www.bootply.com/ugeXrxpPvD
를 사용하여 btn-primary-spacing
모든 버튼의 제거를위한 클래스 margin-left
클래스
예 :
<button type="button" class="btn btn-primary btn-color btn-bg-color btn-sm col-xs-2 btn-primary-spacing">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> ADD PACKET
</button>
CSS는 다음과 같습니다.
.btn-primary-spacing
{
margin-right: 5px;
margin-bottom: 5px !important;
}
You can use built-in spacing from Bootstrap so no need for additional CSS there. This is for Bootstrap 4.
Adding margins to a button makes it wider so that les buttons fit in the grid system. If only a visual effect is important, then give the button a white border with [style="margin:0px; border:solid white;"] This leaves the button width unaffected.
The original code is mostly there, but you need btn-group
s around each button. In Bootstrap 3 you can use a btn-toolbar and a btn-group to get the job done; I haven't done BS4 but it has similar constructs.
<div class="btn-toolbar" role="toolbar">
<div class="btn-group" role="group">
<button class="btn btn-default">Button 1</button>
</div>
<div class="btn-group" role="group">
<button class="btn btn-default">Button 2</button>
</div>
</div>
using bootstrap you can add <div class="col-sm-1 col-xs-1 col-md-1 col-lg-1"></div>
between buttons.
참고URL : https://stackoverflow.com/questions/27689927/how-to-give-spacing-between-buttons-using-bootstrap
'UFO ET IT' 카테고리의 다른 글
phpMyAdmin에 대한 사용자 'root'@ 'localhost'에 대한 액세스 거부 수정 (0) | 2020.11.26 |
---|---|
선택적 배열이 비어 있는지 확인 (0) | 2020.11.26 |
Bootstrap 테이블 열을 콘텐츠에 맞게 만들기 (0) | 2020.11.26 |
VueJS의 동적 구성 요소에 동적으로 소품 전달 (0) | 2020.11.26 |
Bash 스크립팅에 ']'누락 (0) | 2020.11.25 |