HTML(XHTML)基础知识(三)——【image】

<img>

    img 元素用于载入图片,该元素为空元素,用 /> 闭合。

    必需属性:src,图片的来源 URL;alt,图片不能加载时的替代性文本。

    可选属性:width,图片宽度;height,图片高度;ismap,声明图像要被用于服务端图像映射;usemap,用于确定所使用的客户端图像映射,是一个 URL;longdesc,指定有关图像的详细说明的文档 URL。float;margin;padding...

    标准属性:class、dir、id、lang、style、title、xml:lang

===================================================================

背景图像

  1.  
    body {
  2.  
    background-image: url(/images/background.gif);
  3.  
    background-repeat: repeat-x;
  4.  
    /* repeat-y、no-repeat */
  5.  
    background-position: right bottom;
  6.  
    /* 可以是具体的坐标值 */
  7.  
    }

===================================================================

图像映射

  1.  
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2.  
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  3.  
    <head>
  4.  
    <title>My first web page</title>
  5.  
    <style type="text/css">
  6.  
    img { border-style: none }
  7.  
    </style>
  8.  
    </head>
  9.  
    <body>
  10.  
    <p>
  11.  
    <map id="image_map" name="image_map">
  12.  
    <area shape="rect" href="square.html" coords="20,27 97,76" alt="Order Square Pizza" />
  13.  
    <area shape="circle" href="circle.html" coords="167,51 35" alt="Order Round Pizza" />
  14.  
    </map>
  15.  
    <img usemap="#image_map" src="imagemap.gif" alt="Choose square or round pizza!" />
  16.  
    </p>
  17.  
    </body>
  18.  
    <html>

    <map>

        map 元素用于定义一个图像映射,该元素只能包含 area 元素。

        必须属性:id

        可选属性:name

        标准属性:class、dir、id、lang、style、title、xml:lang

        事件属性:onblur、onclick、ondblclick、onfocus、onkeydown、onkeypress、onkeyup、onmousedown、onmousemove、onmouseout、onmouseover、onmouseup

    <area>

 

        area 元素用于定义一个区域,该元素为空元素,用 /> 闭合。

        必需属性:alt,图片不能加载时的替代性文本。

        可选属性:shape,区域的形状,circle(circ)、poly、rect;coords,指定映射中可点击区域的坐标;href,指定区域的超链接;nohref,声明从图像映射中排除,取值为nohref。

        标准属性:accesskey、class、dir、id、lang、style、tabindex、title、xml:lang

        事件属性:onblur、onclick、ondblclick、onfocus、onkeydown、onkeypress、onkeyup、onmousedown、onmousemove、onmouseout、onmouseover、onmouseup

posted @ 2018-08-07 14:48  RickyShilx  阅读(372)  评论(0编辑  收藏  举报