首頁 > web前端 > css教學 > 坐標(HTML屬性)

坐標(HTML屬性)

Lisa Kudrow
發布: 2025-02-26 09:40:09
原創
353 人瀏覽過

coords屬性,用於嵌套在元素內的<a></a>元素中,允許您創建客戶端圖像映射。 這提供了圖像中可單擊的區域,類似於使用<object></object>> <area><map></map>元素。 讓我們探索差異以及如何使用coords

>圖像地圖示例:

考慮此圖像:

coords (HTML attribute)

方法1:使用 elements(傳統圖像映射):<area>> 此方法在

>內使用

元素來定義可單擊區域:<area> <map></map>

<img src="/static/imghw/default1.png"  data-src="https://img.php.cn/upload/article/000/000/000/174053401375600.png"  class="lazy" alt="coords (HTML attribute) " />
<map name="Map">
  <area shape="rect" coords="132,117,270,185" href="https://www.php.cn/link/cf57d08a994170907f4f367c647e075e" alt="Monday's mustache - 'The Hero'">
  <area shape="poly" coords="136,238,137,301,3,306,3,242" href="https://www.php.cn/link/206f6a7ada917912e9389da75d80be3b" alt="Thursday's mustache - 'The Weasel'">
</map>
登入後複製
方法2:使用

>中的元素(替代方法): <a> <object>此方法使用嵌入圖像,並使用

> and

<object>> <a> coordsshape為缺乏適當支持的瀏覽器提供後備內容。

<object data="mustaches.png" type="image/png" width="276" height="375" usemap="#Map2">
  <map name="Map2">
    <ul>
      <li><a href="https://www.php.cn/link/cf57d08a994170907f4f367c647e075e" shape="rect" coords="132,117,270,185">Monday's mustache - 'The Hero'</a></li>
      <li><a href="https://www.php.cn/link/206f6a7ada917912e9389da75d80be3b" shape="poly" coords="136,238,137,301,3,306,3,242">Thursday's mustache - 'The Weasel'</a></li>
    </ul>
  </map>
</object>
登入後複製

<ul></ul>屬性值:<object>

屬性值取決於屬性:coords>

coords>(矩形):shape

    (上左x,上左上y,右下角x,右下y坐標)。
  • rect>(circle):x1,y1,x2,y2(中心x,中心y,radius)。
  • circ>(polygon):x,y,r>(一系列x,y坐標定義多邊形的頂點)。
  • >經常詢問問題(FAQ):poly> 提供的FAQ部分已經全面,並且準確地描述了屬性的用法和限制。 不需要更改。 x1,y1,x2,y2,x3,y3,...

以上是坐標(HTML屬性)的詳細內容。更多資訊請關注PHP中文網其他相關文章!

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
作者最新文章
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板