当前位置: 首页 > 图文教程 > 专题中心 > HTML语言教程专题(文章目录) > html教程之XHTML网页制作方法技巧 > XHTML入门学习教程:XHTML网页图片应用
html教程之XHTML网页制作方法技巧 中的 XHTML入门学习教程:XHTML网页图片应用
合理的添加图片可以使一个网页更加的美观。
<img>标签用于在网页里插入图片。<img>标签有一个重要的属性"src",它的属性值就是图片的地址。下面我们就在我们的index.html里插入一个图片。打开”index.html“文件,在</body>前加上如下代码:
| <p><img src="/upload/tech/20091128/20091128112902_a684eceee76fc522773286a895bc8436.gif" alt="技术支持"/></p> |
保存后浏览网,请确认您的网页与该页面相同。
我们注意到<img>是一个空标签,需要在结尾加上一个"/"以符合XHTML的要求。这里的例子除src外还有一个属性alt,我们把它叫做做替换属性,当图片由于某种原因而无法显示的时候,alt的属性值就会代替图片出现;而当图片正常显示时,只要把鼠标停在图片上就会看到alt属性的属性值。
我们在之前的教程中曾经学习过创建超级链接,下面我们打开“index.html”并且将刚插入的代码改为下面这段:
| <p><a href="http://www.ruanchen.com/"BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"> |
| Sorry, I am unable to validate this document because on line 3, 6-9, 12-14, 16-22 it contained one or more bytes that I cannot interpret as utf-8 (in other words, the bytes found are not valid values in the specified Character Encoding). Please check both the content of the file and the character encoding indication. |
难道我们的网页不符合XHTML标准吗?请继续看下一节的内容。
评论 (0) All