HTML里,怎么给table做一个外面的标题框

html-css012

HTML里,怎么给table做一个外面的标题框,第1张

html中给table增加外面的标题框可以用div嵌套表格的方式来实现:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

"http://www.w3.org/TR/html4/strict.dtd">

<html>

 <head>

   <meta http-equiv="Content-Type" content="text/htmlcharset=utf8">

   <title>Untitled Document</title>

   <script language="JavaScript" src="js/prototype.js"></script>

   <script language="JavaScript">

     function changeStyle(){

       if(document.getElementById('test').style.display=='none'){

         alert("show")

         document.getElementById('test').style.display='block'

       }else{

         alert("hide")

         document.getElementById('test').style.display='none'

       }

     }

   </script>

 </head>

 <body>

   <input value="测试" type="button" onclick="changeStyle()">

   <select type="button" value="测试" onchange="changeStyle()">

     <option>1</option>

     <option>2</option>

   </select>

   <table>

     <tr>

     <td><!--在table中嵌套div时,必须将div放在td中,否则达不到预期效果-->

   <div id="test" style="display:none">

   <table>

     <tr>

       <td>

     <input type="text" value="1"/>

     </td>

     </tr>

   </table>

   </div>

   </td>   

     </tr>

   </table>

 </body>

</html>

 效果:

在WINDOWS窗口中,标题栏用来显示窗口名称,如果是应用程序窗口,标题栏会显示程序名和打开的文档名,HTML窗口的标题栏上显示当前网页的标题,也就是由<title>~</title>定义的内容。

普通标题是:h1~h6

h1是最大标题,h2,h3,h4---h6一次减小,h6是最小标题

表格标题有两个:一个是:caption 一个是:thead 和th

带caption的是有标题的表格

th一般用在标题的表头。