検索

HTML5 セマンティック要素

Sep 04, 2024 pm 04:37 PM
htmlhtml5HTML TutorialHTML PropertiesHTML tags

次の記事では、HTML5 のさまざまなセマンティック要素について説明します。セマンティクスはさまざまなタイプのタグに関するものであり、その機能はタグ名に従って同じ機能を表し、実行します。タグの機能は、ユーザーが理解できる名前/形式になっているその名前によって簡単に理解できます。 HTML の要素のほとんどは一般にセマンティック要素です。

HTML5 のセマンティック要素の利点

セマンティック要素の利点は次のとおりです:

  • コードを簡単に理解できます。
  • メンテナンスを迅速かつ適切に行うことができます。
  • どのタグについても、特に説明を追加する必要はありません。

HTML5 のさまざまなセマンティック要素

セマンティック要素を見てみましょう:

1.

このタグは、このタグ内のデータが特に同様のコンテンツに関するものであるという考えを与えてくれます。それは、私たちが通常持っているさまざまなタイプの記事にも依存します。ブログ、フォーラム、新聞のコラム記事などです。

コード:


<article>
<h2 id="HTML">HTML5</h2>
<p>New Updated version of HTML</p>
</article>
<article>
<h2 id="Learning-HTML">Learning HTML</h2>
<p> We are learning through EDUCBA</p>
</article>

出力:

HTML5 セマンティック要素

2.

このタグは、合計データのセクションの内容を提供するためのものです。記事タグとセクションタグの両方の使用について理解すると、これらのタグを各タグ内で使用できます。つまり、セクションタグは記事タグ内で使用でき、その逆も可能です。

コード:


<section>The section here is about:
<p></p>
<h4 id="Learning-and-practising"> Learning and practising</h4> 
</section>

出力:

HTML5 セマンティック要素

3.

このタグはすべてのヘッダー データを提供します。ヘッダー形式に配置したいデータはすべて、このヘッダー タグの下で使用されます。そして、このタグは HTML スクリプト全体で何度も使用できます。

コード:


<header>
<h3 id="This-is-header">This is header #1</h3>
<p> First one</p>
</header>
<p> next one ...</p>
<header>
<h3 id="This-is-header">This is header #2</h3>
<p> Second one </p>
</header>

出力:

HTML5 セマンティック要素

4.

これは HTML スクリプトのフッター セクションです。通常、すべての著作権データと、オファーの「条件が適用される」などの小さなセクションが表示されます。したがって、これらはフッター タグの下で定義されます。

コード:


<p> Inside Body and above footer tag</p>
<footer>
<p> Inside footer tag.</p>
</footer>
<footer>
<p></p>
<h4 id="Another-footer-tag"> Another footer tag</h4>
<p></p>
<h6 id="Conditions-Apply">Conditions Apply</h6> 
</footer>

出力:

HTML5 セマンティック要素

5.

このタグはナビゲーション要素を提供します。通常、このタグを通じてあるページから別のページに移動する HTML ドキュメント スクリプト内の URL。このタグの下にあるデータはすべてハイパーリンクとして利用できます。これらのハイパーリンクは、あるセクションから別のセクションに移動するのに役立ちます。

コード:


<h4 id="About"> About </h4>
<nav><a href="#"> About link 1</a>
<a href="#"> About link 1</a>
</nav>
<h4 id="Contact"> Contact </h4>
<nav>
<a href="#"> Contact Link 1</a>
<a href="#"> Contact Link 2</a>
</nav>

出力:

HTML5 セマンティック要素

練習中に、これらのリンクをクリックし、クリックしたときにハイパーリンクの色がどのように変化するかを確認してください。

6.

これは、HTML ドキュメントの側面にデータを表示するために使用されるタグです。多くの Web サイトでは、この Side タグを使用して表示されるサイドバーにコンテンツが存在します。このコンテンツは、ドキュメント内に存在する他のデータと一致している必要があります。

コード:


<p>How aside tag is used </p>
<aside>
<h4 id="Inside-aside-tag">Inside aside tag</h4>
<p>Content inside aside tag</p>
</aside>

出力:

HTML5 セマンティック要素

正確な内容を同じ方法で完全に指定することはできません。 HTML ページ全体を使用する場合にのみ、文書化して明確に理解することができます。

7.

このタグは、画像を添付することを指定します。このタグを使用して、画像ソースを指定し、GIF または画像を表示できます。

コード:


<figure>
<img  src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/000/172543905337030.png?x-oss-process=image/resize,p_40" class="lazy" alt="HTML5 セマンティック要素" >
</figure>

上で述べたように、これが Figure タグを定義する方法です。 Figure タグ内で、source タグを使用してイメージ コマンドを指定できます。この図タグ内で、図のキャプション タグを使用できます。

8.

このタグは、提供された画像の下にキャプションを付けるために使用されます。 Figure タグ内で使用できます。その使用法は以下の例で見ることができます。


<figure>
<img  src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/000/172543905337030.png?x-oss-process=image/resize,p_40" class="lazy" alt="HTML5 セマンティック要素" >
<figcaption>This is description of the image attached.</figcaption>
</figure>

画像ソースを指定して同じことを実行して、出力がどのように表示されるかを確認できます。

9.

このタグは、HTML サイトのすべての属性と完全なコンテンツを指定します。ユニークなコンテンツがすべて含まれています。この特定のタグに関して注意すべき重要な点は、このタグはページ作成全体で 1 回しか使用できないということです。他のタグは Web ページの作成時に複数回使用できることがわかりましたが、このメイン タグは 1 回限りの使用タグです。

コード:


<main>
<h1 id="Learning-HTML-Semantic-Tags">Learning HTML Semantic Tags</h1>
<article>
<h4 id="Studying">Studying</h4>
<p> Reading would help to understand different topics</p>
</article>
<article>
<h4 id="Practising">Practising</h4>
<p> With Studying , Practising is a must thing to do in learning</p>
</article>
</main>

出力:

HTML5 セマンティック要素

10.

This tag is for highlighting specific content or data. In other words, this tag is helpful in marking data.

Code:


<p> In this whole text which I am writing now, <mark> I want to mark this text </mark></p>

Output:

HTML5 セマンティック要素

11.

This tag contains additional details that users can hide any details on their wish. Through this tag, users can open/close any content which they need. If we want that tag to disclose its details at the start itself, then the attribute “open” can be used.

Code:


<details open="true">
<p>Is this displayed?</p>
</details>

Output:

HTML5 セマンティック要素

Now, what would be the output if we did not use the open attribute?

Code:


<details>
<p>Is this displayed?</p>
</details>

Output 1:

HTML5 セマンティック要素

Output 2:

HTML5 セマンティック要素

12.

This tag is used inside the details tag. Under the details tag, we can have a summary tag that specifies the entire summary of the web page or the HTML document. An important thing to note here is that the summary tag is the first child tag that has to come under the details tag.

Code:


<details>
<summary> Have written this inside summary tag which is inside details tag</summary>
<p>This text only comes under details tag</p>
</details>
<p> This text data is written after completion of details tag</p>

Output 1:

HTML5 セマンティック要素

We had highlighted the arrow in the above output, as we get our output 2 once we expand it.

Output 2:

HTML5 セマンティック要素

This tag might not be giving out any difference

13.

This tag defines date/time in such a format that users can easily understand. But a thing to note is that this tag may not give us a changed output in many of the browsers.

Code:


<p>At present time is <time>11:00</time> pm in the night.</p>

Output:

HTML5 セマンティック要素

14.

As the name already suggests, this tag is for writing any content in a box. This tag should have an open attribute for displaying the dialog box once the source code is executed.

Code:


<dialog open="true">
<p> The data written here gets displayed in a dialog box </p>
</dialog>

Output:

HTML5 セマンティック要素

15.

This tag gives the progress of a certain task in a graphical representation. We here need to have the maximum number for which the progress has to be represented. This tag mainly consists of two attributes. Max and value are the two attributes. Max represents the total count that has to be completed, and Value gives us the count percent that is finished with respect to the maximum count value.

Code:


<h1 id="EDUCBA">EDUCBA</h1>
Your learning progress is:
<progress value="72" max="100">
</progress>

Output:

HTML5 セマンティック要素

16.

This tag is for measurement. This can be utilized for the space taken by a query or usage of disk space also. There are a few attributes that are to be used with this tag. The attributes are max, min, and value. Based on their usage, we can definitely figure out their purpose and usage.

Code:


<h2 id="EDCUBA">EDCUBA</h2>
<p>Usage of Meter tag</p>
In a 6 floors apartment, I live in 2nd floor:
<meter value="2" min="0" max="6">2 out of 6</meter>

Output:

HTML5 セマンティック要素

17.

This is a tag that has been introduced to add video files to our HTML page. Until this tag was introduced, developers used plugins to introduce video files into HTML page content. There are a few attributes that can be used along with the tag. Autoplay, Preload, Muted are some of these.

Code:


<video>
<source src="video_name.mp4" type="video/mp4">
</source></video>

We just need a source tag to give the source from where we need to upload the video content to our page.

18.

This tag is for adding audio files to our Html page. The usage and the source tag would be the same as that of the video tag. As an exercise, try using all the semantic elements and create e HTML 5 version web page to learn better and faster.

Conclusion

In this article, we have got to see many semantic elements and their usage in HTML5. One important thing to note here is, many of these tags are supported by internet explorer versions greater than 9 and chrome versions greater than 3.

以上がHTML5 セマンティック要素の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
Web開発にとってHTML属性が重要なのはなぜですか?Web開発にとってHTML属性が重要なのはなぜですか?May 12, 2025 am 12:01 AM

htmlattributesarecrucialinwebdevevermentmentmentmentmentmentmentmention behavior、like、andfunctionality.theyenhance -interactivity、accessibility、andseo.forexample、thesrcattribute intagsimpactsseo

Alt属性の目的は何ですか?なぜそれが重要なのですか?Alt属性の目的は何ですか?なぜそれが重要なのですか?May 11, 2025 am 12:01 AM

ALT属性は、HTMLのタグの重要な部分であり、画像の代替テキストを提供するために使用されます。 1.画像をロードできない場合、ALT属性のテキストが表示され、ユーザーエクスペリエンスが向上します。 2。スクリーンリーダーは、ALT属性を使用して、視覚障害のあるユーザーが写真の内容を理解するのに役立ちます。 3. ALT属性のEnginesインデックステキストを検索して、WebページのSEOランキングを改善します。

HTML、CSS、およびJavaScript:例と実用的なアプリケーションHTML、CSS、およびJavaScript:例と実用的なアプリケーションMay 09, 2025 am 12:01 AM

Web開発におけるHTML、CSS、およびJavaScriptの役割は次のとおりです。1。HTMLは、Webページ構造の構築に使用されます。 2。CSSは、Webページの外観を美化するために使用されます。 3. JavaScriptは、動的な相互作用を実現するために使用されます。タグ、スタイル、スクリプトを通じて、これら3つは最新のWebページのコア関数を構築します。

Lang属性をタグにどのように設定しますか?なぜこれが重要なのですか?Lang属性をタグにどのように設定しますか?なぜこれが重要なのですか?May 08, 2025 am 12:03 AM

タグのLang属性を設定することは、WebアクセシビリティとSEOを最適化する重要なステップです。 1)ラング属性をタグに設定します。 2)多言語コンテンツでは、ようなさまざまな言語パーツのLang属性を設定します。 3)「EN」、「FR」、「ZH」などのISO639-1標準に準拠する言語コードを使用します。Lang属性を正しく設定すると、Webページと検索エンジンランキングのアクセシビリティが向上します。

HTML属性の目的は何ですか?HTML属性の目的は何ですか?May 07, 2025 am 12:01 AM

htmlattributeSareSientionalentionalentionalentionalentiallyance'functionalityandappearance.theyaddinformationtodefinebehavior、light、and interaction、makewebsitesteractive、responsive、andviseallyappaleal.attributeslikesrc、href、class、型、およびdoadabledransform

HTMLでリストを作成するにはどうすればよいですか?HTMLでリストを作成するにはどうすればよいですか?May 06, 2025 am 12:01 AM

toreatealistinhtml、useforunorderedlistsandfororderedlists:1)forunorderedlists、wrapitemsinanduseforeachitem、renderingasabulletedlist.2)

HTMLアクション:Webサイト構造の例HTMLアクション:Webサイト構造の例May 05, 2025 am 12:03 AM

HTMLは、明確な構造のWebサイトを構築するために使用されます。 1)Webサイト構造などのタグを使用し、定義します。 2)例は、ブログとeコマースのウェブサイトの構造を示しています。 3)誤ったラベルネスティングなどの一般的な間違いを避けてください。 4)HTTP要求を削減し、セマンティックタグを使用してパフォーマンスを最適化します。

HTMLページに画像を挿入するにはどうすればよいですか?HTMLページに画像を挿入するにはどうすればよいですか?May 04, 2025 am 12:02 AM

to inertanimageintoanhtmlpage、usethetagwithsrcandaltattributes.1)usealttextforaccessibilityandseo.2)emplencesrcsetForresponsiveimages.3)applylazyloadingwithloading = "lazy" tooptimizeperformance.4)

See all articles

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

Dreamweaver Mac版

Dreamweaver Mac版

ビジュアル Web 開発ツール

MantisBT

MantisBT

Mantis は、製品の欠陥追跡を支援するために設計された、導入が簡単な Web ベースの欠陥追跡ツールです。 PHP、MySQL、Web サーバーが必要です。デモおよびホスティング サービスをチェックしてください。

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

SublimeText3 英語版

SublimeText3 英語版

推奨: Win バージョン、コードプロンプトをサポート!