In the race toward SPAs, frameworks, and heavy JS libraries, many developers have forgotten the magical simplicity of native HTML and CSS. These features can add a lot of power to your web apps — without any JavaScript.
🔹 Forgotten HTML Tricks (with Examples)
1. <details>
and <summary>
No JS? No problem! Easily create toggleable content.
<details>
<summary>Show More</summary>
<p>This content is revealed when you click "Show More".</p>
</details>
✅ Perfect for: FAQs, accordions, and hidden sections.
2. Native Input Types
HTML5 brought several smart input types that auto-validate and give enhanced UX.
<form>
Pick a color: <input type="color"><br><br>
Choose a date: <input type="date"><br><br>
Set volume: <input type="range" min="0" max="100">
</form>
✅ Perfect for: Dashboards, forms, and settings panels.
3. spellcheck
Attribute
Disable annoying red underlines for code or brand names.
<textarea spellcheck="false">
type Command = 'ls' | 'cd' | 'rm';
</textarea>
✅ Perfect for: Code blocks, usernames, or technical terms.
4. hidden
Attribute
Quickly hide elements without using CSS classes.
<p>This is visible.</p>
<p hidden>This is not.</p>
✅ Perfect for: Conditional rendering and dynamic UIs.
5. translate="no"
Tell Google Translate to leave certain content alone.
<span translate="no">iPhone 15 Pro Max</span>
✅ Perfect for: Brand names, acronyms, and technical terms.
🔸 Forgotten CSS Tricks (with Examples)
1. Scroll Snapping
Make scrollable containers snap to sections for smooth UX.
HTML:
<div class="scroll-container">
<section class="snap">Section 1</section>
<section class="snap">Section 2</section>
<section class="snap">Section 3</section>
</div>
CSS:
.scroll-container {
scroll-snap-type: y mandatory;
overflow-y: scroll;
height: 100vh;
}
.snap {
scroll-snap-align: start;
height: 100vh;
padding: 2rem;
background: #f5f5f5;
border-bottom: 1px solid #ccc;
}
✅ Perfect for: Presentations, portfolios, full-page sliders.
2. :has()
Parent Selector
Style parents based on child elements — now supported in modern browsers!
Example:
.card:has(img) {
border: 2px solid green;
}
HTML:
<div class="card">
<img src="example.jpg" alt="Image">
<p>Has image</p>
</div>
<div class="card">
<p>No image here</p>
</div>
✅ Perfect for: Dynamic content without JS DOM checks.
3. accent-color
Customize native form controls.
CSS:
input[type="checkbox"],
input[type="radio"],
input[type="range"] {
accent-color: #007BFF;
}
HTML:
<input type="checkbox" checked> Remember me
<input type="range" min="0" max="100">
✅ Perfect for: Keeping brand consistency in forms.
4. clip-path
Easily shape elements like circles, polygons, and custom silhouettes.
CSS:
.circle {
clip-path: circle(50%);
width: 200px;
height: 200px;
background: url('https://via.placeholder.com/200') no-repeat center/cover;
}
HTML:
<div class="circle"></div>
✅ Perfect for: Avatars, creative cards, hover effects.
5. @supports
for Feature Detection
Progressively enhance your styles.
CSS:
@supports (display: grid) {
.layout {
display: grid;
grid-template-columns: 1fr 1fr;
}
}
HTML:
<div class="layout">
<div>Column 1</div>
<div>Column 2</div>
</div>
✅ Perfect for: Cross-browser design safety nets.
6. Pure CSS Tooltip with ::after
Tooltips without JS or libraries.
CSS:
.tooltip {
position: relative;
cursor: help;
}
.tooltip::after {
content: attr(data-tip);
position: absolute;
top: 120%;
left: 0;
background: black;
color: white;
padding: 5px 8px;
border-radius: 4px;
white-space: nowrap;
font-size: 12px;
display: none;
z-index: 10;
}
.tooltip:hover::after {
display: block;
}
HTML:
<span class="tooltip" data-tip="This is a tooltip!">Hover me</span>
✅ Perfect for: Helpful labels, form hints, UI descriptions.
Top comments (0)