Those games are written using the Twine HTML game framework.
There have been a few different "dialects" of the script for Twine games, but the best one at the moment is "sugarcube" (
You must be registered to see the links
). It comes with a default page layout (which you will have seen on dozens of html games).
after that, it's all up to you to write a story, gather your assets, and put them together into a game script.
if you know (or learn) HTML, CSS and Javascript you can do some amazing things, but the beauty of Twine+sugarcube is that you can make progress even without those skills.
There are many youtube tutorials as well, so look around.