插入图片的基本格式为:<img src="url" />
可插入的属性有---替换文本:alt="替换文字" 对齐方式:align="bottom"(与底部对齐,默认是此方式)、"middle"(中间)、"top"(顶部) 浮动方式:align ="left"(浮动在文本左边)、"right" 图片大小:width="50" height="50"(通过width、height属性可以对图片进行缩放) 将图片用作链接:
<a href="//lastpage.html"> <img border="0" src="/eg_buttonnext.gif" /> //border是外边框大小属性 </a>
<map> 标签
<img src="planets.jpg" border="0" usemap="#planetmap" alt="Planets" /><map name="planetmap" id="planetmap">
<area shape="circle" coords="180,139,14" href ="venus.html" 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>
usemap 属性与 <map> 元素的 name 或 id 属性相关联,以建立 <img> 与 <map> 之间的关系。# + 要使用的 <map> 元素的 name 或 id 属性。shape后是图片的形状(circle圆;rect矩形)coords指位置,大小:圆(横坐标,纵坐标,半径)矩形(左上角横坐标,左上角纵坐标,右下角横坐标,右下角纵坐标)
若是背景图片,则格式为:<body background="/i/eg_background.jpg">
时间: 2024-12-17 22:34:26