Chapter 2. Preparing for Website Coding

How Browsers Display Web Pages

In this section, we'll explain how web browsers display web pages. There are two basic rules you need to understand.

A Browser processes HTML code from the top

The HTML file is the master file for website content. When you open an HTML file with a web browser, the browser processes the code written in the HTML file starting from the top. This aspect is important to decide where you write specific lines of code. The lines of code written in the former part of the document can be overwritten by the lines of code written in the latter part of the document.

An HTML file organizes web page resource locations

In an HTML file, you can directly write CSS code or Javascript code; however, those are often written in separate files. In that case, the code file paths are written in the HTML file, and the web browsers read the paths and process the related files.

Web pages usually contain image files such as icons, photos, or illustrations. The image file locations are also written in the HTML file, and browsers get the image file data based on the instructions written in the HTML file. Other media files such as video and audio files are also handled in the same way.

In this section, we'll explain how web browsers display web pages. There are two basic rules you need to understand.

A Browser processes HTML code from the top

The HTML file is the master file for website content. When you open an HTML file with a web browser, the browser processes the code written in the HTML file starting from the top. This aspect is important to decide where you write specific lines of code. The lines of code written in the former part of the document can be overwritten by the lines of code written in the latter part of the document.

An HTML file organizes web page resource locations

In an HTML file, you can directly write CSS code or Javascript code; however, those are often written in separate files. In that case, the code file paths are written in the HTML file, and the web browsers read the paths and process the related files.

Web pages usually contain image files such as icons, photos, or illustrations. The image file locations are also written in the HTML file, and browsers get the image file data based on the instructions written in the HTML file. Other media files such as video and audio files are also handled in the same way.