Hoe OM - Knoppiegroep
Leer hoe om 'n "knoppie-groep" met CSS te skep.
Horisontale Knoppie Groepe
Groepeer 'n reeks knoppies saam op 'n enkele reël in 'n knoppiegroep:
Hoe om 'n knoppiegroep te skep
Stap 1) Voeg HTML by:
Voorbeeld
<div class="btn-group">
<button>Apple</button>
<button>Samsung</button>
<button>Sony</button>
</div>
Stap 2) Voeg CSS by:
Voorbeeld
.btn-group button {
background-color: #04AA6D; /* Green
background */
border: 1px solid green; /* Green border
*/
color: white; /* White text */
padding: 10px
24px; /* Some padding */
cursor: pointer; /*
Pointer/hand icon */
float: left; /* Float the
buttons side by side */
}
.btn-group button:not(:last-child) {
border-right: none; /* Prevent double borders */
}
/* Clear floats (clearfix hack) */
.btn-group:after {
content: "";
clear: both;
display:
table;
}
/* Add a background color on hover */
.btn-group button:hover {
background-color: #3e8e41;
}
Geregverdigde / Volwydte-knoppiegroep:
Voorbeeld
<!-- Three buttons in a group -->
<div class="btn-group" style="width:100%">
<button
style="width:33.3%">Apple</button>
<button style="width:33.3%">Samsung</button>
<button
style="width:33.3%">Sony</button>
</div>
<!--
Four buttons in a group -->
<div class="btn-group" style="width:100%">
<button
style="width:25%">Apple</button>
<button style="width:25%">Samsung</button>
<button
style="width:25%">Sony</button>
<button
style="width:25%">HTC</button>
</div>
Wenk: Gaan na ons CSS-knoppie-tutoriaal om meer te wete te kom oor hoe om knoppies te styl.