官术网_书友最值得收藏!

HTML

Originally, web pages consisted primarily of many individual files, each containing all the design information and data, and links to any images that needed to be displayed on a single viewable page. This information and data was, and still is, written in a language called HTML.

While many people refer to HTML as a programming language, it is in fact, as the name states, a markup language. That is a language that doesn't provide instructions on something to do (a program) but instead, tells how to display itself and the data it contains.

This means that HTML code by itself is not capable of actually doing anything except structuring and displaying static data in a certain way.

HTML works by putting the data inside tags, indicated with greater than and less than symbols, and these tags tell the reader (usually a web browser) how to organize the data structurally.

Some examples of HTML tags:

<h1>This is a level 1 Header</h1>
<p>This is a paragraph</p>
<div>This is a div, used to divide information into logical containers.</div>
<ul>
<li>A List Item (li) in an unordered list (ul).</li>
</ul>
<span>This is a span of text. </span>

An HTML document almost always has at least the following tags:

<html>
<head></head>
<body></body>
</html>

The <head></head> tags are used to hold information about the document which affects the display of the data, but does not actually get displayed on the page itself, whereas the <body></body> tags contain the data that is to be displayed in the web browser.

HTML can also contain extra pieces of information inside the actual tags themselves, and not just between the tags. These bits of information are called attributes. The extra information in these attributes is used to provide extra features and functionality to the HTML when displayed. For example, links and images need to be told where to send people when clicked, or what image to load.

<a href="www.awebsite.com">A link to a website</a>
<img src="www.awebsite.com/logo.jpg" />

We probably noticed that the image tag, <img>, didn't have a closing tag with a slash in it. This is because some tags can be self closed if it doesn't make sense for them to have two tags, such as with our image. To self close a tag, simply put a slash as the last character in the tag.

Note

This is far from a complete guide to HTML, as there are dozens, if not hundreds of guides to HTML online and in book form. Please look to them for more information HTML. Also recommended is the website www.w3schools.com for more detailed information on HTML and its descendant, XHTML.

We can also use a style attribute in our HTML code to add design elements to what is otherwise only a logical structure.

<span style="color:red; font-weight:bold; background-color:yellow">It's an emergency!</span>

Originally, this was how most HTML was styled. However, it was quickly realized that mixing design information, structural information, and the data itself into the same file was dangerous and made updating the data difficult without affecting the design, and updating the design was difficult without potentially affecting the data. So an attempt was made to strip the design information out of the HTML files, leaving only the data and data structure in the original files, and putting the design information into separate files.

This led to what is today called cascading style sheets (CSS), separate files containing the majority of the design information for a web page:

HTML
主站蜘蛛池模板: 莱西市| 贵阳市| 滨州市| 大足县| 沿河| 三门县| 新余市| 诸暨市| 宿州市| 丹凤县| 明水县| 大同县| 永兴县| 耒阳市| 瓦房店市| 云霄县| 山东省| 抚松县| 工布江达县| 怀柔区| 且末县| 祁阳县| 开鲁县| 榆林市| 怀仁县| 城市| 漠河县| 蛟河市| 林西县| 乐清市| 克东县| 集安市| 长汀县| 齐齐哈尔市| 庆阳市| 博客| 竹北市| 景东| 沧州市| 贵南县| 安仁县|