Web Development Lesson 2 - Lists
Checklists
Setup
<h2>Checklist</h2>
<ul>
<li>100g flour</li>
<li>2 eggs</li>
<li>300ml milk</li>
</ul>
<li><input type="checkbox" name="flour">100g flour</li>
<li><input type="checkbox" name="eggs">2 eggs</li>
<li><input type="checkbox" name="milk">300ml milk</li>
There are many types of inputs (text, radio selectors, buttons etc) so we need to define which type we want with type="checkbox"
.
We also want to differentiate the items, so we name each using name="flour"
.
Open your code in Live Server to see the square in front of your text. Try clicking it to see that it's actually an interactive checkbox.
The bullets are now unnecessary, so let's remove them with
CSS.
ul {
list-style-type: none;
}
Next: Menus