JS is useful
but often overused
HTML & CSS are lighter
- No JS
- No build tools
- No npm packages
- Just HTML & CSS
HTML Tricks
- Content Targeting
- Accordians
- Form Validations
Content Targeting
<!-- Links to another page or website -->
<a href="/about">Other page</a>
<a href="https://google.com">Other website</a>
<!-- A File or Resource -->
<a href="/img/my_image.jpg" download>Download Image</a>
<a href="/resources/info.pdf">View PDF</a>
<!-- An ID -->
<a href="#main">Skip to main content</a>
<a href="/about#contact">Contact the team</a>
.my_element:target {
background: pink;
}
- 2010
- 2015
- 2008
- 2006
- 2011
Full Disclosure…
Accordians
<details>
<summary>This bit is clickable to expand/collapse</summary>
<p>This content is hidden but can then be expanded or re-collapsed.</p>
</details>
- 2011
- 2020
- 2012
- 2016
Full Disclosure…
Form Validations
Required Fields
<input name="email" required />
Data Format
<input type="date" name="due_date">
<input type="tel" name="phone" pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}" />
- 2010
- 2015
- 2010
- 2011
- 2012
- 2011
- 2015
- 2017
- 2011
- 2012
Full Disclosure…
CSS Tricks
- Nesting
- Range Slider
- Testimonials
- Toggle Switch
- Image Carousel
Nesting
div {
& p {
color: red;
}
}
- 2023
- 2023
- 2023
- 2023
Range Slider
<input type="range" min="0" max="10" />
<input type="range" min="0" max="10" list="options" />
<datalist id="options">
<option value="0">Not good</option>
<option value="5">🤷♀️</option>
<option value="10">Stupendous</option>
</datalist>
- 2010
- 2015
- 2008
- 2013
- 2012
- 2018
- 2020
- 2019
- 2023
- 2022
- 2022
- 2022
- 🙅♀️
Testimonials
<input type="radio" id="t_1" name="testimonials" />
<label for="t_1">Quote 1</label>
<blockquote>
<!-- Quote here -->
</blockquote>
div:has(p:nth-child(4)) {
--children: 4;
}
div:has(p:nth-child(5)) {
--children: 5;
}
- 2022
- 2022
- 2022
- 🙅♀️
- 2021
- 2021
- 2015
- 2020
- 2017
- 2017
- 2017
- 2017
- 2017
Full Disclosure…
Toggle Switch
<div class="toggle">
<input id="off" type="radio" name="switch" value="off" checked />
<label for="off">Off</label>
<input id="on" type="radio" name="switch" value="on" />
<label for="on">On</label>
<span class="switch"></span>
</div>
body {
@media(prefers-color-scheme: dark) {
--background: #0d0d0d;
--neutral: #f7f0eb;
}
}
- 2022
- 2022
- 2022
- 🙅♀️
- 2019
- 2020
- 2019
- 2019
Full Disclosure…
Image Carousel
<input type="radio" name="images" value="i_1" id="img_1" checked />
<label for="img_1">Image 1</label>
<div class="image">
<img src="img_1.jpg" alt="" />
</div>
- 2017
- 2017
- 2017
- 2017
- 2017
- 2022
- 2022
- 2022
- 🙅♀️
Full Disclosure…
nojs.amyskapers.dev
JS is useful but not the answer
Can you do it with HTML?
Can you do it with CSS?
Can JS make it better?
Can some JS be removed?
Do we really need to track this?
Questions?
Thank You👏