In a web page, what are the roles of HTML, CSS and JavaScript?
Options
- All three of them do exactly the same job
- HTML: structure. CSS: look and layout. JS: behavior (Correct option)
- HTML is styling; CSS is logic; JS is content
- Only JavaScript is needed to build a web page
Answer
HTML = structure and content; CSS = appearance and layout; JavaScript = behavior and interactivity
Why
Think of a house:
- HTML is the structure: walls, rooms, doors. Headings, paragraphs, buttons, forms.
- CSS is the decoration: paint, furniture placement. Colors, fonts, spacing, layout.
- JavaScript is the electricity: things that react. Clicks, fetching data, updating the page without reloading.
Remember
HTML = what, CSS = how it looks, JS = what it does.