You can create static HTML-Websites/-Documents on your PC and view them in your browser. You can then add features using CSS or JS.
Then, you can use a VM and install a webserver in it. You can use it to simulate and practice server side scripting, for example with PHP. You can also try out open source software in it, for example blog software.
Then, when you have something to publish, you can rent webspace. Nowadays SSL is important. You need to figure out how to get a certificate installed at your hoster.
IMPORTANT: Do NOT rent a root server, because you will be responsible for keeping the whole OS updated and secure. Something that fails often. Use a managed option, so you're just responsible for your web apps.