Once you finish writing the code and organizing the files that make up your website, you need to put it all online so people can find it. This article explains how to get your simple sample code online with little effort.
Publishing a website is a complex topic because there are many ways to go about it. This article doesn't attempt to document all the possible methods. Instead, it explains the advantages and disadvantages of three approaches that are practical for beginners. Then it steps through one method that can work right away for many readers.
To have more control over content and website appearance, most people choose to buy web hosting and a domain name:
http://www.mozilla.org
or
http://www.bbc.co.uk
. You can rent your domain name for as many years as you want from a
domain registrar
.
Many professional websites go online this way.
In addition, you will need a File Transfer Protocol (FTP) program (see How much does it cost: software for more details) to actually transfer the website files over to the server. FTP programs vary widely, but generally, you have to connect to your web server using details provided by your hosting company (typically username, password, hostname). Then the program shows you your local files and the web server's files in two windows, and provides a way for you to transfer files back and forth.
Some tools let you publish your website online:
These options are usually free, but you may outgrow the limited feature-set.
There are a number of web apps that emulate a website development environment, allowing you to enter HTML, CSS and JavaScript, and then display the result of that code as a website — all in one browser tab. Generally speaking, these tools are relatively easy, great for learning, good for sharing code (for example, if you want to share a technique with or ask for debugging help from colleagues in a different office), and free (for basic features). They host your rendered page at a unique web address. However, the features are limited, and these apps usually don't provide hosting space for assets (like images).
Try playing with some of these examples to find out which one works best for you:
Now let's examine how to easily publish your site via GitHub Pages.
注意:
Make sure your folder has an
index.html
文件。
注意: It may take a few minutes for your website to go live. If your website does not display immediately, wait a few minutes. Try again.
To learn more, see GitHub Pages Help .
最后修改: , 由 MDN 贡献者