Reputation:
I am at the very beginning of learning HTML, but I am having trouble opening the new HTML file in a browser. In fact, my files don't seem to give me that option. What I've done is named a text document index.html and nothing more. Any help would be appreciated. My operating system is windows 10.
Upvotes: 0
Views: 656
Reputation: 366
Try this simple way:
<html>
<head>
</head>
<body>
<h1>Hello world</h1>
</body>
</html>
It will open HTML page with the header "Hello World" at the top.
Upvotes: 1
Reputation: 53
I'm guessing you are using visual studio.
Inside the file you created (index.html), you can use emmet(a plugin that comes with vs) to set up your file correctly. Just type "!" in your empty HTML page and then press enter. Emmet will automatically fill all your file needs.
Then you will also need to run it on your local server. You have a tab on the left side of visual studio, go to extensions and look for "live server". Install it. When it's ready, on the bottom right of your VS you have a new option named "Go live", press it. If you don't see you can use the shortcut "Alt + L Alt + O"
If the browser doesn't open by itself after that, you can write down "localhost:{the number where it opened it}
Upvotes: 1