Used to store extra custom data inside HTML elements, accessible via JS.
<button data-user-id="101">Profile</button>
<script>
console.log(document.querySelector("button").dataset.userId); // 101
</script>
Inline: inside element → <p style="color:red">
Internal: inside <style> in head
External: separate .css file (✅ best practice)
Normal: blocks HTML until loaded
async: loads parallel, executes immediately
defer: loads parallel, executes after HTML parsed
<script src="app.js" async></script>
<script src="app.js" defer></script>
Normal DOM: global, styles affect whole page
Shadow DOM: encapsulated, style isolated (Web Components)
iframe: loads entire external webpage
AJAX: loads only data without page reload
Used to display reserved characters.
< = <
> = >
& = &
" = "
' = '
© = ©
Progressive: shows content as it loads
Lazy loading: loads images only when needed
JS code that adds modern browser features to older browsers.
Example: fetch() polyfill for old browsers.
Security mechanism to control cross-origin requests via server headers.
Minify CSS/JS, lazy load images, use async/defer, reduce DOM, caching.
Loads images only when user scrolls near them.
<img src="photo.jpg" loading="lazy">
Inline SVG: inside HTML, styleable with CSS/JS
External SVG: used via <img>, limited styling
⬅ Home