Sunday, 28 July 2013

Understanding Web Page Languages

Understanding Web Page Languages

So far you’ve seen that the web is made up of web servers and web browsers. Web servers are the computers that host the web pages, videos, images, and other content that you view on the web. The browsers are what you use to view that content. Browsers like Internet Explorer and Safari run on your computer.

Mobile phones use browsers too. The iPhone uses a version of Safari while Android-based phones use a proprietary browser or sometimes another browser like a mobile version of Google Chrome or Firefox.

Web browsers and servers talk to each other using a language, or protocol, known as HTTP. Just as browsers and servers talk to each other using their own special language, web pages themselves have their own special languages. This section looks at the three primary web page languages: HyperText Markup Language (HTML), Cascading Style Sheets (CSS), and JavaScript.

Marking up with HTML

Web pages are documents, much like the document that you’d create in a word processor like Microsoft Word. To read a word processor document you use software like Microsoft Word, which knows how to open, read, and parse documents formatted or laid out in a certain way so that the various headings, spacing, and other elements of that document appear as intended.

Here’s an example: We’re writing this book in Microsoft Word. Each of the headings has a certain format while the main text has a different format. A new paragraph is created every time one of your humble book authors presses Enter. Microsoft Word knows how to open this document and interpret those headings, paragraphs, and other elements, so if we send it to you and you also have Microsoft Word, you can open and see the document in the same way that we do. Behind the scenes, hidden formatting elements tell Microsoft Word how to format or layout and display the text you see on the page.

HyperText Markup Language (HTML) provides the behind-the-scenes formatting and layout information for web pages. In much the same way as the behind-the-scenes formatting of a Word document tells Microsoft Word how to display that document, HTML tells the web browser how to display a web page.

HTML marks up, or adds hidden information to, the text and other things that you put on a web page. This hidden information is responsible for the layout of the page. For example, you can use HTML to indicate that specific text is a paragraph or a heading, and yet more HTML to indicate an image.

Just as there are rules for formatting a book such as this (for example, any level 2 headings appear below the primary, level 1 headings), so too are web pages formatted in a special way. Ideally, web pages follow certain rules such as smaller headings appearing within larger ones, and so on.

When HTML on a web page is formatted correctly, with headings and other elements appearing in the proper order, the web page is said to be valid and have what’s called semantic markup. Semantic markup is a term used to describe a web page that correctly uses the HTML formatting elements in the right places.

Later, you discover how to make the web browser understand formatting to create headings, paragraphs, insert images, and more, all with HTML.

No comments:

Post a Comment