HTML-02

2019-08-29  本文已影响0人  白雪公主960

图像和链接

URL

http:协议名(用://分隔)
www.w3.org:主机名
/TR/CSS2/:目录路径
syndata.html:要链接的文件名

文件从最高级目录下开始的完整的路径

2.本机资源
文件从最高级目录下开始查找
file:///E:xiaoni/ni.jpg

根相对路径:永远都是从WEB站点的根目录开始查找
用/作为开始
/img/index/jd.jpg

图像

<img width="100" src="image/rose.jpg"/>

链接

<a href="http://www.baidu.com">百度链接</a>
<a href="teacher/teacher.asp" target="_blank">去其他的页面</a>

href属性:链接URL(只有设置了href,元素才可以被点击)
target属性:目标,即打开新网页的方式,可取值为_blank(在新标签页中打开),_self(在自身标签页中打开)等
name属性:锚点名称

目标文档为下载资源<a href="day09.zip">下载</a>
电子邮件链接<a href="mailto:xiaoyanger960@qq.com">联系我们</a>
(前提是电脑必须安装了邮件客户端并绑定账号)
返回页面顶部的空链接<a href="#">...</a>
链接到Javascript<a href="javascript:...">JS功能</a>

描点是文档中某行的一个记号,链接到文档中的某个部位
使用方式:
1.定义锚点 <a name="anchorname1">锚点1</a>
2.链接到锚点:在锚点名前加上# <a href="#anchorname1">...</a>
(如果文本和图像与锚点存在于同一个页面)
<a href="URL#anchorname1">...</a>

表格

表格的作用

1.显示表格数据

2.设置页面布局

使用表格

<table>
 <tr>
  <td></td>
  <td></td>
 </tr>
 <tr>
  <td></td>
  <td></td>
 </tr>
</table>

<tr>元素
align 设置水平对齐方式(left right center)
valign 设置垂直对齐方式(top bottom middle)
bgcolor 设置当前行的背景颜色

<td>元素
align 设置水平对齐方式
valign 设置垂直对齐方式
width 设置宽度
height 设置高度
colspan 设置单元格跨列
rowspan 设置单元格跨行

<table border="1">
  <caption>this is my table</caption>
  <tr>
    <td></td>
  </tr>
</table>

2.行标题/列标题
显示效果:水平居中,并加粗显示文本
<th></th>--><td></td>

表格的复杂应用

<table border="1" width="300" >
  <thead align="center">
    <tr>
      <td>姓名</td>
      <td>年龄</td>
    </tr>
  </thead>
  <tbody align="left">
    <tr>
      <td>张三</td>
      <td>14</td>
    </tr>
    <tr>
      <td>李四</td>
      <td>19</td>
    </tr>
  </tbody>
</table>

注意:如果不设置行分组,那么所有的行被默认当成是tbody的内容。

结构标记

结构标记概述

<body>
  <header>页头</header>
  <section>主体内容</section>
  <footer>页脚</footer>
</body>

结构标记

<body>
  <header>
    <img src="image/flower.jpg">
    <h1>welcome to my homepage </h1>
  </header>
</body>
<body>
  <header>flowers</header>
  <nav>
     <ul>
           <li><a href="">rose</a></li>
           <li><a href="">daisy</a></li>
           <li><a href="">daffodil</a></li>
      </ul>
  </nav>
</body>
<body>
<header>rose</header>
<section>
     <img src="image/rose.jpg alt="rose"/>
     With sunshine,water,and careful tending,roses will bloom several times in aa saeson.
</section>
</body>
<body>
   <header>rose</header>
 <section>
    With sunshine,water,and careful tending.roses will bloom several in a season .
 </section>
  <article>
      <h1>internet explorer 9</h1>
      <p>IE9于2001年3月14日发布</p>
  </article>
</body>
<body>
  <footer>
    <ul>
       <li><a href="'>关于我们</a></li>
       <li><a href="'>站点地图</a></li>
       <li><a href="'>帮助</a></li>
    </ul>
  </footer>
</body>
<body>
  <aside>
    <p>最新留言</p>
    <section>广告section>
  </aside>
  <footer>
     <ul>
        <li><a href="'>关于我们</a></li>
       <li><a href="'>站点地图</a></li>
       <li><a href="'>帮助</a></li>
     </ul>
  </footer>
       <span>&copy;2012 XX官网     京ICP证XXX号</span>
  </footer>
</body>
上一篇 下一篇

猜你喜欢

热点阅读