この記事では、HTML のエリアタグについて学びます。エリア タグは、イメージ マップ内のホットスポットを定義し、ハイパーテキスト参照と関連付けまたはリンクして、ユーザーが Web ページ上でクリックできるようにします。地図部分をクリックすると、さまざまなページにリンクするのに役立ちます。また、タグは、画像上に複数のリンクが必要な場合に役立ちます。
構文
基本的な構文を以下に示します:
<area alt="text" class=" " coords=" " shape> ;
ここでは、画像がレンダリングされない場合の代替テキストとして alt が使用されます。
- class: 要素のクラス名を定義します。
- coords: 形状の値のセットがあります。
イメージ マップの場合、構文は次のとおりです。
<img src="/static/imghwm/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/imghwm/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 へのリンクを意味します。領域をハイパーリンクに変更します。 | |
形状 | 画像上で実行されるさまざまな形状を定義します。 | |
座標 | 画像内の領域に適切な特定の値を与えます。座標は次のように指定されます:
デフォルト: コードは必要ありません。 長方形: 左、上、右、下 円: x、y、半径 Poly: x1,y1, x2,y2,x3,y3… |
|
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) | |
hreflang | Specifies language-type |
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/imghwm/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:
Example #2
Code:
<img class="logo lazy" src="/static/imghwm/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:
The Output below shows the logo of HTMLのエリアタグ; clicking the word BA directs to the page Hello page.
Example #3
Code:
<img src="/static/imghwm/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:
Output:
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 サイトの他の関連記事を参照してください。

htmltagsareSterenceforwebdevelovementasyStheStructureanhandhancewebpages.1)theydefineLayout、semantics、and-interactivity.2)semanticagsimprovecessibility.3)opeusofusofagscanoptimizeperformanceandensurecross-brows-compativeation。

コードの読みやすさ、保守性、効率を向上させるため、一貫したHTMLエンコーディングスタイルは重要です。 1)低ケースタグと属性を使用します。2)一貫したインデントを保持し、3)シングルまたはダブルの引用符を選択して固執する、4)プロジェクトのさまざまなスタイルの混合を避け、5)きれいなスタイルやEslintなどの自動化ツールを使用して、スタイルの一貫性を確保します。

Bootstrap4にマルチプロジェクトカルーセルを実装するソリューションBootstrap4にマルチプロジェクトカルーセルを実装するのは簡単な作業ではありません。ブートストラップですが...

マウススクロールイベントの浸透の効果を実現する方法は? Webを閲覧すると、いくつかの特別なインタラクションデザインに遭遇することがよくあります。たとえば、DeepSeekの公式ウェブサイトでは、...

HTMLビデオのデフォルトの再生コントロールスタイルは、CSSを介して直接変更することはできません。 1. JavaScriptを使用してカスタムコントロールを作成します。 2。CSSを介してこれらのコントロールを美化します。 3. video.jsやPLYRなどのライブラリを使用すると、互換性、ユーザーエクスペリエンス、パフォーマンスを検討してください。プロセスを簡素化できます。

携帯電話でネイティブセレクトを使用する際の潜在的な問題は、モバイルアプリケーションを開発するときに、ボックスを選択する必要があることがよくあります。通常、開発者...

お使いの携帯電話でネイティブ選択を使用することの欠点は何ですか?モバイルデバイスでアプリケーションを開発する場合、適切なUIコンポーネントを選択することが非常に重要です。多くの開発者...

Three.JSとOctreeを使用して、部屋でのサードパーソンローミングの衝突処理を最適化します。 3つのjsでoctreeを使用して、部屋でサードパーソンローミングを実装し、衝突を追加してください...


ホットAIツール

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

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

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

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

人気の記事

ホットツール

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

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

メモ帳++7.3.1
使いやすく無料のコードエディター

MinGW - Minimalist GNU for Windows
このプロジェクトは osdn.net/projects/mingw に移行中です。引き続きそこでフォローしていただけます。 MinGW: GNU Compiler Collection (GCC) のネイティブ Windows ポートであり、ネイティブ Windows アプリケーションを構築するための自由に配布可能なインポート ライブラリとヘッダー ファイルであり、C99 機能をサポートする MSVC ランタイムの拡張機能が含まれています。すべての MinGW ソフトウェアは 64 ビット Windows プラットフォームで実行できます。

ドリームウィーバー CS6
ビジュアル Web 開発ツール

ホットトピック









