W3.CSS — Checkboxes
Basic Checkbox
<input type="checkbox" class="w3-check"> Check me
Checkbox Styles
<!-- Default -->
<input type="checkbox" class="w3-check"> Default
<!-- Checked -->
<input type="checkbox" class="w3-check" checked> Checked
<!-- Disabled -->
<input type="checkbox" class="w3-check" disabled> Disabled
Checkbox Group
<div class="w3-row">
<input type="checkbox" class="w3-check" name="option1" value="1"> Option 1
</div>
<div class="w3-row">
<input type="checkbox" class="w3-check" name="option2" value="2"> Option 2
</div>
<div class="w3-row">
<input type="checkbox" class="w3-check" name="option3" value="3"> Option 3
</div>
Checkbox Examples
<!-- Form with checkboxes -->
<form>
<div class="w3-row">
<input type="checkbox" class="w3-check" name="interest" value="html"> HTML
</div>
<div class="w3-row">
<input type="checkbox" class="w3-check" name="interest" value="css"> CSS
</div>
<div class="w3-row">
<input type="checkbox" class="w3-check" name="interest" value="javascript"> JavaScript
</div>
<button class="w3-button w3-blue">Submit</button>
</form>
<!-- Terms checkbox -->
<div class="w3-row">
<input type="checkbox" class="w3-check" id="terms">
<label for="terms">I agree to the Terms and Conditions</label>
</div>
Checkbox with Label
<label>
<input type="checkbox" class="w3-check"> Subscribe to newsletter
</label>
<label>
<input type="checkbox" class="w3-check" checked> Receive notifications
</label>
Mini Practice
Create HTML code that:
- Creates a basic checkbox
- Adds a checkbox group
- Creates a form with checkboxes
- Uses checkboxes with labels
Up Next
Next: Learn about W3.CSS Radio Buttons.
Related Topics
Frequently Asked Questions about Checkboxes
What is Checkboxes in W3.CSS?
Checkboxes is a fundamental concept in W3.CSS. This lesson explains it step by step with clear examples, making it easy for beginners to understand.
How do I learn Checkboxes?
Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Checkboxes.
Why is Checkboxes important in W3.CSS?
Checkboxes is essential for W3.CSS development. Understanding this concept will help you write better code and solve real-world problems more effectively.