Q1
Why do browsers close <p> paragraphs nicely yet break whole page colors if you forget the closing </div> or </h1> tag?
Every opening HTML tag needs a matching closing </tag> container boundary (nesting); missing a closing </div> or </h1> traps all the following content inside the parent box or huge heading size!
Q2
Why does changing <h1 style='color: green'> work when your style.css file says h1 { color: black; }?
CSS follows Specificity & Priority (Inline style beats #id which beats .class which beats plain tag selectors!). Keeping styles organized in style.css classes keeps websites clean and easy to change.
Q3
Why does putting an image path like C:\Users\Kid\Desktop\cat.png break when sharing your HTML website with friends online?
Other people's laptops don't have your personal Desktop folder! Always put images inside an images/ folder right next to index.html and link using a relative path (images/cat.png).
Q4
How do HTML Flexbox (`display: flex`) and Grid arrange game cards cleanly side-by-side instead of stacking vertically?
Normally HTML <div> boxes stack top-to-bottom like bricks. Adding display: flex; gap: 16px; lines cards up cleanly in rows and wraps automatically onto mobile screens!
Q5
What happens when JavaScript runs document.getElementById('score') BEFORE the HTML <p id='score'> finishes loading?
If <script> sits inside <head> above <body>, JS returns null because #score hasn't been drawn yet! Always put <script> right before </body> or add defer.
Q6
Why is === safer than = when checking a quiz score in JavaScript (if (score === 10))?
A single = *stores/overwrites* the number 10 into score accidentally! Triple equals === *compares* whether score equals 10 safely without changing it.
Q7
How does addEventListener('click', ...) make buttons interactive without cluttering HTML?
It listens cleanly for user clicks, key presses (keydown), or mouse movement and runs a custom JavaScript function—like updating scoreboards or toggling dark mode!
Q8
Why does `alt='Golden retriever puppy'` inside <img> matter even when the photo loads fine?
If slow Wi-Fi fails to load the image, alt text explains what belongs there, helps screen readers read aloud to visually impaired users, and tells Google Images what the picture shows.
Q9
What is the difference between Padding and Margin inside the CSS Box Model?
Padding is breathing space *inside* the button/card border around text, while Margin is outer spacing *between* two separate neighbor cards.
Q10
Why do Math.floor(Math.random() * 6) + 1 simulate a fair 6-sided dice roll in kid web games?
Math.random() returns decimals between 0 and 0.999.... Multiplying by 6 gives 0..5.999, Math.floor() chops decimals cleanly to 0..5, and + 1 shifts it nicely to 1..6!