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

Semantic Markup

You will hear the word "semantic" used often when you read or hear about HTML. The core concept behind semantic markup is to ensure that you use the most meaningful HTML element available to describe the content you are marking up. For example, it would be possible for you to wrap the top-level page heading in a div tag, however, the h1 tag conveys the meaning that the content represents, that is, heading level 1. The HTML you write needs to be understandable to both humans and machines, and by using the most meaningful element for each piece of content, you improve the meaning of both.

Ensuring that the HTML you write is as semantic as possible also has additional important benefits. The first being that it will make your web pages more easily searchable by search engines. You will also be helping out users who view your websites using a screen reader.

The following code shows some examples of semantic and non-semantic markup:

<!-- Semantic markup -->

<h1>I am a top level page heading</h1>

<p>This is a paragraph which contains a word with <strong>strong</strong> significance</p>

<!-- Non semantic markup -->

<div>I am a top level page heading</div>

<div>This is a paragraph which contains a word with <span>strong</span> significance</div>

Hopefully, you should now understand the differences between semantic and non-semantic markup. Now that we have some knowledge of the most commonly used HTML elements used for content, we can turn to the more fun part of styling.

主站蜘蛛池模板: 喜德县| 新化县| 大名县| 泰和县| 清流县| 斗六市| 武穴市| 留坝县| 广宗县| 长岭县| 镇平县| 松潘县| 隆尧县| 乌兰察布市| 黔东| 商都县| 灵丘县| 丰原市| 静安区| 宁武县| 阜新市| 赣榆县| 黄浦区| 汾阳市| 梅河口市| 肥西县| 呼玛县| 根河市| 裕民县| 夏河县| 防城港市| 自贡市| 苗栗县| 确山县| 平邑县| 池州市| 罗城| 夹江县| 常山县| 罗甸县| 五大连池市|