目次
エリアタグは HTML でどのように機能しますか?
属性
1.タグ固有の属性
2. Standard Attributes
3. Global Attributes
Examples to Implement Area Tags in HTML
Example #3
Conclusion

HTMLのエリアタグ

Sep 04, 2024 pm 04:31 PM
html html5 HTML Tutorial HTML Properties HTML tags

この記事では、HTML のエリアタグについて学びます。エリア タグは、イメージ マップ内のホットスポットを定義し、ハイパーテキスト参照と関連付けまたはリンクして、ユーザーが Web ページ上でクリックできるようにします。地図部分をクリックすると、さまざまなページにリンクするのに役立ちます。また、タグは、画像上に複数のリンクが必要な場合に役立ちます。

構文

基本的な構文を以下に示します:

<area alt="text" class=" " coords=" " shape> ;
ログイン後にコピー

ここでは、画像がレンダリングされない場合の代替テキストとして alt が使用されます。

  • class: 要素のクラス名を定義します。
  • coords: 形状の値のセットがあります。

イメージ マップの場合、構文は次のとおりです。

<img  src="/static/imghw/default1.png" data-src="edu.jpg" class="lazy" html name alt="HTMLのエリアタグ" >
<map name=" name">
<area shape="shapeName1" coords="x,y coordinates" href="html%20linkPath">
<area shape="shapeName2" coords=" x,y coordinates " href="htmllinkPath">
</map>
ログイン後にコピー

説明: これは終了タグのない空のタグですが、XHTML の場合は として宣言されます。そして、このエリアタグは常にで埋め込まれます。タグ (マップ コンテナに含まれています)。特定の画像の座標値を提供します。また、非アクティブな領域が重複して発生します。より高い領域がアクティブになることを優先することで解決されます。次の部分では、エリア タグの使用方法と例、ブラウザの互換性とそれらによってサポートされる属性について説明します。

エリアタグは HTML でどのように機能しますか?

これを完了するためのプロセスは次のとおりです。最初は、イメージ マップ内のイメージです。

1. ページに画像を挿入するには、以下に示す画像タグを使用する必要があります:

<img src="/static/imghw/default1.png" data-src="edu.jpg" class="lazy" alt="HTMLのエリアタグ logo"> // image from the saved folder. Also, we can get from the web URL directly and map with <map> tag.</map>
ログイン後にコピー

これには src 属性が付属しています: 画像コンテンツを説明するソースと代替テキスト。

2. 次に、#map 属性を持つマップ要素を開きます。このイメージ タグには、use map の後に「#」記号が付いています (use map =” #map”)。マップ名は HTMLのエリアタグ と同じ名前である必要があります。

イメージマップを作成するには?イメージとマップを一緒にするには、map 属性と name 属性を一緒に使用します。ブラウザは、画面上のマウスカーソルがポインタ(手のマーク)になると、その図形の領域を認識します。

3. マップに使用される領域を宣言します。

<area shape="rect" cords='…….href="" ' alt="">
href comes with alt attribute by default.
ログイン後にコピー

属性

一般に、HTML タグには、ブラウザーに視覚的に快適に表示するのに役立つ 1 つ以上の属性があります。使用される属性には、グローバル属性、イベント処理属性、要素固有の属性の 3 種類があります。 area タグは、以下に示すタグ固有の属性とその説明を提供します。HTML 5 にはいくつかの新しい属性があります。

1.タグ固有の属性

属性の名前 説明
alt 指定された領域に代替テキストを定義して、アクセシビリティを向上させます。
href ハイパー参照とは、ページの次のページ ポイント/URL へのリンクを意味します。領域をハイパーリンクに変更します。 document”shape=”circle”
形状 画像上で実行されるさまざまな形状を定義します。 ”最初のドキュメント”shape=”circle”

”2

座標 画像内の領域に適切な特定の値を与えます。座標は次のように指定されます:

デフォルト: コードは必要ありません。

長方形: 左、上、右、下

円: x、y、半径

Poly: x1,y1, x2,y2,x3,y3…

document”
target Specifies where to open the link page, or I can say the end target page. ”
Nohref Defines that absence of href. This means the area doesn’t have a link to next page
type Specifies the content type (MIME) ”Authors
hreflang Specifies language-type ”Second

2. Standard Attributes

The description of these attributes has already been discussed in the previous article.

  • Access key
  • class
  • dir
  • id
  • Style
  • lang
  • id
  • tab index
  • title.

3. Global Attributes

  • onmouse down
  • onmouse up
  • onmouse over
  • onmouse move
  • onmouse out
  • on focus
  • on blur
  • onkey press
  • onkey down
  • onkey up.

Examples to Implement Area Tags in HTML

Below are examples of implementing area tags in HTML:

Example #1

In the below example, I have created a jpg image diary.jpg. When u execute the code, the hand tool moves over the image at the specified cords; when you click on it, it directs you to the page rr.html.

Code:



<img  src="/static/imghw/default1.png" data-src="diary.jpg" class="lazy" html alt="HTMLのエリアタグ" >
<map name="Diary">
<area shape="rect" coords="94,91,189,193" href="rr.html">
</map>

ログイン後にコピー

Code: rr.html



hello

 Online tutorial Class
ログイン後にコピー
ログイン後にコピー

Output:

HTMLのエリアタグ

Example #2

Code:



<img class="logo lazy" src="/static/imghw/default1.png" data-src="edu.jpg" alt="HTMLのエリアタグ logo"    style="max-width:90%"  style="max-width:90%" html>
<map name="ccmap">
<area shape="rect" coords="89,9,294,50" href="sha.html" alt="HTMLのエリアタグ">
<area shape="rect" coords="297,7,407,54" href="rr.html" alt="Welcome">
</map>

ログイン後にコピー

Code: rr.html



hello

 Online tutorial Class
ログイン後にコピー
ログイン後にコピー

Code: sha.html



hello

 Welcome to the Page
ログイン後にコピー

Output:

HTMLのエリアタグ

The Output below shows the logo of HTMLのエリアタグ; clicking the word BA directs to the page Hello page.

HTMLのエリアタグ

Example #3

Code:



<img src="/static/imghw/default1.png" data-src="new.png" class="lazy" alt="HTMLのエリアタグ" border="0" html>
<map name="Protocols">
<area shape="Poly" coords="74,0,113,29,98,72,52,72,38,27" href="https://www.manageengine.com/network-monitoring/what-is-snmp.html%22" alt="SNMP Tutorial" target="_blank">
<area shape="rect" coords="22,83,126,125" alt="FTP Tutorial" href="https://www.techtarget.com/searchnetworking/definition/File-Transfer-Protocol-FTP" target="_blank">
<area shape="circle" coords="73,168,32" alt="http Tutorial" href="https://www.webopedia.com/TERM/H/HTTP.html" target="_blank">
</map>

ログイン後にコピー

Explanation of the above program: In this example, we have created an image map using the image file called new.png, which has three clickable areas declared within it using the tag. The first clickable area is a polygonal shape that links to the SNMP page called www.managengine.com. The second clickable area is a rectangular shape that links to the FTP page called www.searchnetworking.com, and finally, the last clickable area is a circle that links to an HTTP page called www.webopedia.com.

Output:

HTMLのエリアタグ

Output:

HTMLのエリアタグ

Conclusion

Therefore, we have seen how the area tag is used in active areas in switching to the pages with brief information explaining how to use the tag in clickable areas with syntax and demo examples.

以上がHTMLのエリアタグの詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホット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 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

SublimeText3 中国語版

SublimeText3 中国語版

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

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

HTMLの表の境界線 HTMLの表の境界線 Sep 04, 2024 pm 04:49 PM

HTML の表の境界線に関するガイド。ここでは、HTML でのテーブルの境界線の例を示しながら、テーブル境界線を定義する複数の方法について説明します。

HTML のネストされたテーブル HTML のネストされたテーブル Sep 04, 2024 pm 04:49 PM

これは、HTML でのネストされたテーブルのガイドです。ここでは、テーブル内にテーブルを作成する方法をそれぞれの例とともに説明します。

HTML 左マージン HTML 左マージン Sep 04, 2024 pm 04:48 PM

HTML マージン左のガイド。ここでは、HTML margin-left の概要とその例、およびそのコード実装について説明します。

HTML テーブルのレイアウト HTML テーブルのレイアウト Sep 04, 2024 pm 04:54 PM

HTML テーブル レイアウトのガイド。ここでは、HTML テーブル レイアウトの値と例および出力について詳しく説明します。

HTML入力プレースホルダー HTML入力プレースホルダー Sep 04, 2024 pm 04:54 PM

HTML 入力プレースホルダーのガイド。ここでは、コードと出力とともに HTML 入力プレースホルダーの例について説明します。

HTML 順序付きリスト HTML 順序付きリスト Sep 04, 2024 pm 04:43 PM

HTML 順序付きリストのガイド。ここでは、HTML 順序付きリストと型の導入とその例についても説明します。

HTML の onclick ボタン HTML の onclick ボタン Sep 04, 2024 pm 04:49 PM

HTML オンクリック ボタンのガイド。ここでは、それらの紹介、動作、例、およびさまざまなイベントでの onclick イベントについてそれぞれ説明します。

HTML 内のテキストの移動 HTML 内のテキストの移動 Sep 04, 2024 pm 04:45 PM

HTML でのテキストの移動に関するガイド。ここでは、概要、マーキー タグが構文でどのように機能するか、および実装例について説明します。

See all articles