img标签和scr属性
插入图像的语法:<img src=”url”>,url 指向图像存储地址.
alt 属性: 用来给图像显示一个"交互文本", alt的属性值是由用户定义的. alt 属性在浏览器装载图像失败的时候告诉用户所丢失的信息, 此时显示这个"交互文本".
调整图像大小:
<html>
<body>
<p><img src="./test.gif" ;200" heigth="200">
</p>
<p><img src="./test.gif" ;450" heigth="450">
</p>
<p><img src="./test.gi" ;700" heigth="700" >
</p>
<p>
you can make a picture larger or smaller changing the values in the "heigth" and "width" attributes for the img tab.
</p>
</body>
</html>
<body>
<p><img src="./test.gif" ;200" heigth="200">
</p>
<p><img src="./test.gif" ;450" heigth="450">
</p>
<p><img src="./test.gi" ;700" heigth="700" >
</p>
<p>
you can make a picture larger or smaller changing the values in the "heigth" and "width" attributes for the img tab.
</p>
</body>
</html>
运行显示如下:
背景图像
<html>
<body background="./background.jpg">
<h3>Look: A background p_w_picpath!</h>
<p>both gif and jpg files can be used as HTML backgrounds.</p>
<p>if the p_w_picpath is smaller than the page, the p_w_picpath will repeat itself.</p>
<body background="./background.jpg">
<h3>Look: A background p_w_picpath!</h>
<p>both gif and jpg files can be used as HTML backgrounds.</p>
<p>if the p_w_picpath is smaller than the page, the p_w_picpath will repeat itself.</p>
</body>
</html>
</html>
运行代码, 结果如下:
图像链接:
<html>
<body>
<a href="back.htm"><img src="link.jpg" ;40" height="40"></a>
</body>
</html>
<body>
<a href="back.htm"><img src="link.jpg" ;40" height="40"></a>
</body>
</html>
运行结果如下:
转载于:https://blog.51cto.com/shylx123/506743