HTML超链接怎么写

HTML超链接怎么写,第1张

HTML超链接可以用a标签来设置。

1、新建html文档,在body标签中添加a标签,为a标签添加“href”属性

2、设置“href”属性的属性值为“page.html”,这时点击a标签会跳转到“page.html”页面:

3、为a标签设置“target”属性,属性值为“_blank”,这样“page.html”会在新标签打开,设置为“_self”则会在自身页面打开:

使用HTML <map>标签,给图片设置热点(指定的要添加链接的地方)

例子:

<img src="planets.jpg" border="0" usemap="#planetmap" alt="Planets" border="0" />

<map name="planetmap" id="planetmap">

<area shape="circle" coords="180,139,14" href ="venus.html" style="cursor: pointer" alt="Venus" />

<area shape="circle" coords="129,161,10" href ="mercur.html" alt="Mercury" />

<area shape="rect" coords="0,0,110,260" href ="sun.html" alt="Sun" />

</map>

关于例子的解释:

area 元素永远嵌套在 map 元素内部。area 元素可定义图像映射中的区域。

<img>中的 usemap 属性可引用 <map>中的 id 或 name 属性(取决于浏览器),所以应同时向 <map>添加 id 和 name 属性。

x1,y1,x2,y2

如果 shape 属性设置为 "rect",则该值规定矩形左上角和右下角的坐标

x,y,radius

如果 shape 属性设置为 "circ",则该值规定圆心的坐标和半径。

x1,y1,x2,y2,..,xn,yn

如果 shape 属性设置为 "poly",则该值规定多边形各边的坐标。如果第一个坐标和最后一个坐标不一致,那么为了关闭多边形,浏览器必须添加最后一对坐标。

<html>

<head>

  <title>hello word</title>

<style type="text/css">

*, ul, li { margin: 0 border: 0 padding: 0 box-sizing: border-box }

ul { list-style: none }

.ul,.ul1{display:inline-block float:leftmargin:0 auto}

img{height:200px width:200px}

.ul li:nth-of-type(2),.ul1 li:nth-of-type(2){text-align:center}

</style>  

</head>

<body>

<div class="ul">

  <ul> 

    <li> <img src=...></li>  

    <li>这图片很好看</li>

  </ul>

    <ul> 

    <li> <img src=...></li>  

    <li>这图片很好看</li>

  </ul>

  </div>

  

  <div class="ul1">  

    <ul> 

    <li> <img src=...></li>  

    <li>这图片很好看</li>

  </ul>

    <ul> 

    <li> <img src=...></li>  

    <li>这图片很好看</li>

  </ul>

</div>

</body>

</html>


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/6249778.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-19
下一篇 2023-03-19

发表评论

登录后才能评论

评论列表(0条)

保存