HTML/CSS/JavaScript Fundamentals: The Core Every Developer Must Know in 2026
The essential HTML, CSS, and JavaScript knowledge that separates senior developers from juniors. Covers semantic HTML, CSS specificity, JavaScript async patterns, and common mistakes.
HTML/CSS/JavaScript Fundamentals: The Core Every Developer Must Know in 2026
Semantic HTML Matters
<!-- β Non-semantic -->
<div class="nav">
<div class="item"><a href="/">Home</a></div>
<div class="item"><a href="/about">About</a></div>
</div>
<!-- β
Semantic -->
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
</nav>
Why: Screen readers, search engines, and browsers understand semantic HTML better. Itβs also easier to style.
CSS Specificity
When multiple rules target the same element, CSS specificity decides who wins:
| Selector | Specificity Score |
|---|---|
* | 0 |
p | 1 |
.nav | 10 |
#sidebar | 100 |
style="..." | 1000 |
!important | Infinity (avoid) |
/* Example specificity battle */
/* Line 1: specificity = 1 */
p { color: blue; }
/* Line 2: specificity = 10 */
.nav p { color: red; } /* WINS β specificity 10 > 1 */
/* Line 3: specificity = 100 */
#sidebar p { color: green; } /* WINS β specificity 100 > 10 */
Rule: Keep specificity low. Avoid !important. Use BEM or CSS Modules to scope styles.
JavaScript Async: Promise vs async/await
// β Callback hell
getUser(userId, (user) => {
getOrders(user.id, (orders) => {
getProducts(orders, (products) => {
render(user, orders, products);
});
});
});
// β
Promise chain
getUser(userId)
.then(user => getOrders(user.id))
.then(orders => getProducts(orders))
.then(products => render(user, orders, products))
.catch(error => console.error(error));
// β
async/await (recommended)
async function loadData(userId) {
try {
const user = await getUser(userId);
const orders = await getOrders(user.id);
const products = await getProducts(orders);
render(user, orders, products);
} catch (error) {
console.error(error);
}
}
The Event Loop
console.log('1'); // runs first (synchronous)
setTimeout(() => console.log('3'), 0); // added to queue, runs after sync code
Promise.resolve().then(() => console.log('4')); // added to microtask queue, runs before setTimeout
console.log('2');
// Output: 1 β 2 β 4 β 3
Why: Microtasks (Promises) run before macrotasks (setTimeout). The event loop processes all microtasks before picking up the next macrotask.
DOM Manipulation Performance
// β Causes reflow every iteration
for (let i = 0; i < 1000; i++) {
document.body.appendChild(document.createElement('div'));
}
// β
Batch DOM operations
const fragment = document.createDocumentFragment();
for (let i = 0; i < 1000; i++) {
fragment.appendChild(document.createElement('div'));
}
document.body.appendChild(fragment); // Single reflow
The this Keyword
const obj = {
name: 'Alice',
greet: function() {
console.log(`Hello, ${this.name}`);
},
greetArrow: () => {
console.log(`Hello, ${this.name}`); // `this` is NOT obj!
}
};
obj.greet(); // "Hello, Alice" β `this` is obj
obj.greetArrow(); // "Hello, undefined" β arrow captures outer `this`
Local Storage vs Session Storage vs Cookies
| Feature | localStorage | sessionStorage | Cookies |
|---|---|---|---|
| Capacity | 5-10 MB | 5-10 MB | 4 KB |
| Expiry | Never | Tab close | Configurable |
| Sent with HTTP | β No | β No | β Yes (automatically) |
| Accessible from JS | β Yes | β Yes | β Yes |
// localStorage
localStorage.setItem('token', 'abc123');
const token = localStorage.getItem('token');
localStorage.removeItem('token'); Free Newsletter
Level Up Your Dev Workflow
Get new tools, guides, and productivity tips delivered to your inbox.
Plus: grab the free Developer Productivity Checklist when you subscribe.
Found this guide useful? Check out our free developer tools.
Affiliate disclosure: Some links below are affiliate links β we may earn a small commission at no extra cost to you. Learn more.
Recommended Tools & Resources
DigitalOcean
$200 credit for new users. Simple, affordable cloud hosting for developers.
GitHub Student Pack
Free access to 100+ developer tools. Perfect for students and new devs.
Vercel
Deploy frontend apps instantly. Free tier is generous for side projects.
DevPlaybook Products
Boilerplates, scripts & AI toolkits to 10x your dev workflow.