با عرض سلام و وقت بخیر خدمت کاربران سایت پی وی لرن . و کاربرانی که دوره کامل آموزش Bootstrap 4 ، را دنبال می کنند. درمطالب اخیر دوره ، ما وارد طراحی های آماده عناصر html در Bootstrap 4 ،شدیم. و در ادامه قصد داریم به موضوع گروه بندی Button در Bootstrap 4 و لیست کشویی تکی در بوت استرپ ، بپردازیم.
همچنین ما، برخی موضوعات پایه و ضروری در طراحی هر سایت از جمله طراحی هشدارها در Bootstrap 4 و مبحث پر کاربرد طراحی Button در Bootstrap 4 ، را نیز ارائه کردیم.
اکنون به سراغ موضوع این جلسه، گروه بندی Button در Bootstrap 4 ، می رویم.
Bootstrap 4 ، به شما اجازه می دهد که تعدادی از عناصر Button ، را با هم گروه بندی کنید.
1 2 3 4 5 | <div class="btn-group"> <button type="button" class="btn btn-primary">Apple</button> <button type="button" class="btn btn-primary">Samsung</button> <button type="button" class="btn btn-primary">Sony</button> </div> |
به جای تنظیم اندازه هر button ، در گروه ، شما می توانید ، از کلاس .btn-group-lg
، برای گروه بندی سیاز بزرگ button ، و از کلاس .btn-group-sm
نیز ، برای گروه بندی سایز کوچک button ، استفاده کنید.
انداره بزرگ:
1 2 3 4 5 | <div class="btn-group btn-group-lg"> <button type="button" class="btn btn-primary">Apple</button> <button type="button" class="btn btn-primary">Samsung</button> <button type="button" class="btn btn-primary">Sony</button> </div> |
Bootstrap 4 ، همچنین از گروه بندی عمودی نیز ، پشتیبانی می کند.
.btn-group-vertical
، استفاده کنید.1 2 3 4 5 | <div class="btn-group-vertical"> <button type="button" class="btn btn-primary">Apple</button> <button type="button" class="btn btn-primary">Samsung</button> <button type="button" class="btn btn-primary">Sony</button> </div> |
مثال ۲: استفاده از یک button ، با لیست کشویی:
1 2 3 4 5 6 7 8 9 10 | <div class="btn-group"> <button type="button" class="btn btn-primary">Sony</button> <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"> <span class="caret"></span> </button> <div class="dropdown-menu"> <a class="dropdown-item" href="#">Tablet</a> <a class="dropdown-item" href="#">Smartphone</a> </div> </div> |
1 2 3 4 5 6 7 8 9 10 11 12 13 | <div class="btn-group-vertical"> <button type="button" class="btn btn-primary">Apple</button> <button type="button" class="btn btn-primary">Samsung</button> <div class="btn-group"> <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> Sony </button> <div class="dropdown-menu"> <a class="dropdown-item" href="#">Tablet</a> <a class="dropdown-item" href="#">Smartphone</a> </div> </div> </div> |
مثال:
1 2 3 4 5 6 7 8 9 10 11 | <div class="btn-group"> <button type="button" class="btn btn-primary">Apple</button> <button type="button" class="btn btn-primary">Samsung</button> <button type="button" class="btn btn-primary">Sony</button> </div> <div class="btn-group"> <button type="button" class="btn btn-primary">BMW</button> <button type="button" class="btn btn-primary">Mercedes</button> <button type="button" class="btn btn-primary">Volvo</button> </div> |
مثال:
1 2 3 4 5 6 7 8 9 10 11 12 13 | <div class="btn-group-vertical"> <button type="button" class="btn btn-primary">Apple</button> <button type="button" class="btn btn-primary">Samsung</button> <div class="btn-group"> <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> Sony </button> <div class="dropdown-menu"> <a class="dropdown-item" href="#">Tablet</a> <a class="dropdown-item" href="#">Smartphone</a> </div> </div> </div> |
گروه بندی های Button بطور پیش فرض در حالت “inline” است. که باعث قرار گرفتن گروه بندی ها در یک خط می شود.
مثال:
1 2 3 4 5 6 7 8 9 10 11 | <div class="btn-group"> <button type="button" class="btn btn-primary">Apple</button> <button type="button" class="btn btn-primary">Samsung</button> <button type="button" class="btn btn-primary">Sony</button> </div> <div class="btn-group"> <button type="button" class="btn btn-primary">BMW</button> <button type="button" class="btn btn-primary">Mercedes</button> <button type="button" class="btn btn-primary">Volvo</button> </div> |
خب ما در مطالب قبلی این دوره ، به طراحی های آماده button ، در Bootstrap 4 ، اشاره کردیم. و در ادامه ی همین مبحث نیز ، در این جلسه به موضوع گروه بندی Button در Bootstrap 4 ، پرداختیم. امیدواریم که مطالب فوق ، مورد استفاده تمامی کاربران پی وی لرن ، قرار گرفته باشد.