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

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.

主站蜘蛛池模板: 普陀区| 资中县| 合阳县| 新晃| 墨脱县| 托克逊县| 和龙市| 二连浩特市| 桐乡市| 阜城县| 清涧县| 蒙阴县| 巴马| 南陵县| 若羌县| 周宁县| 孝义市| 云南省| 定陶县| 石屏县| 沂南县| 渭南市| 阿瓦提县| 新晃| 屏东县| 营口市| 天门市| 藁城市| 清流县| 盐池县| 桦南县| 彭泽县| 东港市| 资中县| 蕉岭县| 镇雄县| 马边| 佛学| 阿拉善左旗| 枞阳县| 通榆县|