results matching ""
No results matching ""
4.6.Run example on your local computer?
There are many methods to run example code. The common mission of those methods is saving example code to HTML file and then seeing how it looks in the web browser.
¶ 4.6.1. Method 1. Using Text Editor
HTML can be created and modified by using any text editors. Follow the four steps below to create a HTML file with TextEdit.
- Click on the menu: File -> New -> HTML.
- Paste an example code in the edit area.
- Save file ends with the “.html” extension.
- Open this file to run the example.
Reference:https://www.w3schools.com/html/html_editors.asp
Saving HTML Document.
From within text editing program, click File, and then Save. name the file “example.html”. It is very important that the file ends with the “.html” extension. This tells our computer what type of file our document is and how to run it. Choose If you’re on a Windows PC, be sure to click the dropdown box below the file name input, labeled “Save as type:” and select the option “All files”. This will insure your document is saved in the correct format. Go ahead and save your document.
¶ 4.6.2. Method 2. Creating HTML files in NotePad
NotePad, is a common Windows accessory that saves documents only in text format, which makes it ideal for formatting HTML.
Open NotePad: Start, Programs, Accesories, NotePad. NotePad should launch with a new document open. From the File pull-down menu, Select "Save As," save the file to the Desktop, and name the file using the ".html" extension (e.g., "home.html"). You must be sure to save the file with the ".html" extension because NotePad will otherwise add the ".txt" extension which will confuse most Web browsers.
Paste an example code in the edit area.
Save file ends with the “.html” extension.
- Open this file to run the example.
¶ 4.6.3. Method 3. Using the vi Editor console
create a new HTML file by typing
vi example.html
where "example" is the name you wish to give the new file.
Paste the code in the new file.
To save the edits you have made, but leave vi running and your file open:
Press
Press
¶ 4.6.4. Viewing HTML File In a Web Browser
Now navigate to wherever you chose to save your file (I recommend creating a new folder on your desktop to store all of your learning files) and double click “test.html.” This should open our page in a web browser and you should be greeted by a result of code running.
小礼物刷一波,打赏作者

Paypal Donate

Venmo Donate

WeChat微信打赏

Alipay支付宝打赏