検索

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 までご連絡ください。
HTML対CSS対JavaScript:比較概要HTML対CSS対JavaScript:比較概要Apr 16, 2025 am 12:04 AM

Web開発におけるHTML、CSS、およびJavaScriptの役割は次のとおりです。HTMLはコンテンツ構造を担当し、CSSはスタイルを担当し、JavaScriptは動的な動作を担当します。 1。HTMLは、セマンティクスを確保するためにタグを使用してWebページの構造とコンテンツを定義します。 2。CSSは、セレクターと属性を介してWebページスタイルを制御して、美しく読みやすくします。 3。JavaScriptは、動的でインタラクティブな関数を実現するために、スクリプトを通じてWebページの動作を制御します。

HTML:それはプログラミング言語か何か他のものですか?HTML:それはプログラミング言語か何か他のものですか?Apr 15, 2025 am 12:13 AM

htmlisnotaprogramminglanguage; itisamarkuplanguage.1)htmlStructuresandformatswebcontentusingtags.2)ItworkswithcsssssssssdjavascriptforInteractivity、強化を促進します。

HTML:Webページの構造の構築HTML:Webページの構造の構築Apr 14, 2025 am 12:14 AM

HTMLは、Webページ構造の構築の基礎です。 1。HTMLは、コンテンツ構造とセマンティクス、および使用などを定義します。タグ。 2. SEO効果を改善するために、などのセマンティックマーカーを提供します。 3.タグを介したユーザーの相互作用を実現するには、フォーム検証に注意してください。 4. JavaScriptと組み合わせて、動的効果を実現するなどの高度な要素を使用します。 5.一般的なエラーには、閉じられていないラベルと引用されていない属性値が含まれ、検証ツールが必要です。 6.最適化戦略には、HTTP要求の削減、HTMLの圧縮、セマンティックタグの使用などが含まれます。

テキストからウェブサイトへ:HTMLの力テキストからウェブサイトへ:HTMLの力Apr 13, 2025 am 12:07 AM

HTMLは、Webページを構築するために使用される言語であり、タグと属性を使用してWebページの構造とコンテンツを定義します。 1)htmlは、などのタグを介してドキュメント構造を整理します。 2)ブラウザはHTMLを分析してDOMを構築し、Webページをレンダリングします。 3)マルチメディア関数を強化するなど、HTML5の新機能。 4)一般的なエラーには、閉じられていないラベルと引用されていない属性値が含まれます。 5)最適化の提案には、セマンティックタグの使用とファイルサイズの削減が含まれます。

HTML、CSS、およびJavaScriptの理解:初心者向けガイドHTML、CSS、およびJavaScriptの理解:初心者向けガイドApr 12, 2025 am 12:02 AM

webdevelopmentReliesOnhtml、css、andjavascript:1)htmlStructuresContent、2)cssStylesit、および3)Javascriptaddsinteractivity、形成、

HTMLの役割:Webコンテンツの構造HTMLの役割:Webコンテンツの構造Apr 11, 2025 am 12:12 AM

HTMLの役割は、タグと属性を使用してWebページの構造とコンテンツを定義することです。 1。HTMLは、読みやすく理解しやすいようなタグを介してコンテンツを整理します。 2。アクセシビリティとSEOを強化するには、セマンティックタグなどを使用します。 3. HTMLコードの最適化により、Webページの読み込み速度とユーザーエクスペリエンスが向上する可能性があります。

HTMLとコード:用語を詳しく見るHTMLとコード:用語を詳しく見るApr 10, 2025 am 09:28 AM

htmlisaspecifictypeofcodefocuseduructuringwebcontent

HTML、CSS、およびJavaScript:Web開発者に不可欠なツールHTML、CSS、およびJavaScript:Web開発者に不可欠なツールApr 09, 2025 am 12:12 AM

HTML、CSS、およびJavaScriptは、Web開発の3つの柱です。 1。HTMLは、Webページ構造を定義し、などなどのタグを使用します。2。CSSは、色、フォントサイズなどのセレクターと属性を使用してWebページスタイルを制御します。

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衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

EditPlus 中国語クラック版

EditPlus 中国語クラック版

サイズが小さく、構文の強調表示、コード プロンプト機能はサポートされていません

MantisBT

MantisBT

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

DVWA

DVWA

Damn Vulnerable Web App (DVWA) は、非常に脆弱な PHP/MySQL Web アプリケーションです。その主な目的は、セキュリティ専門家が法的環境でスキルとツールをテストするのに役立ち、Web 開発者が Web アプリケーションを保護するプロセスをより深く理解できるようにし、教師/生徒が教室環境で Web アプリケーションを教え/学習できるようにすることです。安全。 DVWA の目標は、シンプルでわかりやすいインターフェイスを通じて、さまざまな難易度で最も一般的な Web 脆弱性のいくつかを実践することです。このソフトウェアは、

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Eclipse を SAP NetWeaver アプリケーション サーバーと統合します。

AtomエディタMac版ダウンロード

AtomエディタMac版ダウンロード

最も人気のあるオープンソースエディター