The need to queue things
The web started as a simple document-based system with a text-based protocol called HTTP. You have a URL that contains a name of a machine (which gets resolved using another protocol called DNS) and the path of the required document and the software running over the host machine (called an HTTP server because it could parse the HTTP protocol and carry out the required) and will return that document back to you.
HTML was the language to mark text within those documents, sections, headings and links to other documents along with some formatting tags. Formatting within documents turned out to be tedious to maintain across hundreds of documents so it moved out as separate style documents called style sheets written in a notation called CSS.
Then came the interactivity part, someone from Netscape included a small language resembling Java called JavaScript enabling you to respond to events such as mouse clicks and key presses on certain elements and the rest, as they say...