Home Web Front-end HTML Tutorial Detailed explanation of table tags in html

Detailed explanation of table tags in html

Mar 25, 2017 am 11:31 AM

Statement 1: The text here is copied from my own csdn account. It is the crystallization of my own learning and summary, so please respect this work. 2: If you want to reprint this article, you must indicate the source of the text. 3: If there is anything wrong, please point it out.

In the previous article, I mainly talked about some basic tags of http, such as link tags, image tags, html frames, etc. Then the next step will focus on table tags and list tags. , a detailed explanation of form tags

1: Table tags

##
Table tags


 <!DOCTYPE html>
     <html>
         <head>
             <!-- 原创作者:蜗牛 -->
             <title>table标签</title>
         </head>
         <body>
             <table  border="1" width="360"  height="240" 
                     cellspacing="1" cellpadding="1" 
                     align="center" bgcolor="red">   <!--这里的center表示该表格在页面的中间位置-->
                                                     <!--这里的背景色标签是bgcolor-->
                     <caption><h2>我的好朋友</caption>
 
                      <tr>
                          <th>姓名</th>
                  <th>性别</th>
                          <th>年龄</th>
                          <th>爱好</th>                     
                      </tr>
 
                      <tr align="center">          <!--这里的center表示的是表格里面的字体居中-->
                          <td>小红</td>
                          <td>女</td>
                          <td>20</td>
                          <td>跳舞</td>
                      </tr>
 
                      <tr align="center"> 
                          <td>小舵</td>
                          <td>女</td>
                          <td>24</td>
                          <td>唱歌</td>
                      </tr>
                     
                 </table>
</body>
</html>
Copy after login

Note: ## The label is used to represent the line

The label is used to represent the column

The label is used to represent the title of the table, usage and The same, but the content inside will be automatically enlarged and bolded

border                                                                                                                                           using using through together using using using using out off out out out out off out through out out out through out out out out out out through - t's Set the height of the table, the unit is pixel

cellspacing Set the distance between cells, which refers to the spacing of the table border

cellpadding Set the distance between the text and the cell border

bgcolor Set the background color of the table

align Used to set the alignment, such as center, left, right

The header name is used to represent the header

(2) About merging cells

<!DOCTYPE html>
<html>
    <head>     
        <title>table中合并单元格</title>
    </head>
    <body>
        <table  border="1" width="300"  height="200" 
                align="center" background="first.jpg" >  <!--background代表的是背景图片,bgcolor代表背景色完全不一样-->

                  <tr align="center" width="100" >
                     <td>1</td>
                     <td colspan="2">占两列</td>    <!--当colspan="2"表示在同一行中,两列并一列,那么在它下面少写一个<td></td>标签-->
                     <!-- 删除掉此<td></td> -->
                     <td>2</td>
                 </tr>

                 <tr   align="center" width="100">  
                     <td rowspan="2">占两行</td>   <!--当 rowspan="2"表示在同一列中 两行并一行,那么在同一列中删掉一个<td></td>标签-->
                     <td>3</td>
                     <td>4</td>
                     <td>5</td>
                 </tr>

                  <tr   align="center" width="100" >
                    <!-- 删除掉此<td></td> -->
                     <td>6</td>
                     <td>7</td>
                     <td>8</td>
                 </tr>          
            </table>
   </body>
</html>
Copy after login


Note

: When you enter different content in each cell of the table, your content will change with different lengths. If you want each cell to maintain There are two ways to make the same size: 1; For example, when the total height of your table is 400 and you set 4 rows, then add attributes to each tag: hight=100; which is equivalent to even distribution, and use the same width for the same width. method. 2: It will be simpler than the first one, which is to set the css style and fix the size of tr and td

2: List tag

<!DOCTYPE html>
<html>
    <head>
    <title>列表标签</title>
    </head>
    <body  bgcolor="#FFFF00">
        <!-- 无序列表 -->
        2017年心愿
        <ul type="circle">     <!--无序序列<ul> ,无序有circle:圆点,square:小方块-->
            <li>父母身体健康</li>
            <li>宝宝健康成长</li>
            <li>媳妇健健康康</li>
        </ul>

        <!-- 有序列表 -->
        2017年大事件
        <ol type="1" start="2">   <!--有序的标签是<ol>,有序有五种:1,A,a ,i,I,start代表从什么时候开始等于2代表从2开始--> 
            <li>老婆要生小孩了</li>
            <li>自己换工作了</li>
            <li>要卖掉一套房</li>
        </ol>
        
        <!-- 自定义列表 -->
        <dl>                    <!--在自定义列表<dl> </dl>中使用<dt> </dt>表示小标题,使用<dd> </dd>表示列表项-->
            <dt>时刻告诉自己</dt>
            <dd>不抱怨</dd>
            <dd>零负能量</dd>
            <dd>该与不该</dd>
        </dl>
    </body>
</html>
Copy after login
The running results are as follows:


3: Form

< form> Form tag##

 <!DOCTYPE html>
<head>
<title>form表单</title>
</head>
<body>
<!--form 指的是表单标签   当前标签的内容在提交的时候都会被自动提交    action=""是指把当前表单提交的位置-->
    <form action="Myservlet" method="post" onSubmit="return submitFun();"> <!--onSubmit只有当返回为true是才能提交表单-->
        <fieldset>                       <!--主要会在相关表单元素周围绘制边框-->
            <legend>用户注册</legend>    <!--在上面绘制的边框绘制的位置写上“用户注册”-->
        <!--input 一个输入框里    type 的当前输入框的类型   text 是指当前的类型是文本框name是用来区分不同的文本框-->
                             <!--的也是在表单提交后用来获取表单的内容 -->   
         用户名:<input type="text" name="username" /><br/><br/>
         密码 :<input type="password" name="password"/><br/><br/>  <!--password代表输入的文字显示为黑点-->
         <!--value是指当前表单提交后 获取的值    checked设置默认选中的情况-->
         性别:男性<input type="radio" name="sex" value="male" checked="checked"> <!--radio代表单选按钮-->
               女性<input type="radio" name="sex" value="female">    <br/><br/>            
         学历: <select name="education">                               <!--select代表下来列表-->
                     <option value="gz">博士</option>                <!--option代表每一个值,取名gz为了后台获取-->
                    <option value="yjs">研究生</option>                          
                    <option value="bk" selected="selected">本科</option>  <!--select代表默认选中,本科会显示到界面-->
                    <option value="zk">专科</option>                              
                 </select>     <br/><br/>
        兴趣爱好:<input type="checkbox" name="likes" value="bike" />骑车   <!--checkbox复选框-->
                 <input type="checkbox" name="likes" value="sleep" checked="checked" />睡觉  <!--checked代表默认选中-->
                 <input type="checkbox" name="likes" value="eat" />吃饭
                 <input type="checkbox" name="likes" value="daima" />敲代码 <br/>
        备注:<textarea  cols="40"  rows="5" name="bz"></textarea> <br/><br/>  <!--textarea文本域设置行和列-->
                个人头像:<input type="file"><br>           <!--代表可以在电脑上宣文件-->
      <!--disabled代表不可编辑,我在测试中发现不可编辑状态后台是无法取到这个value值的,想要获得就要在提交时改变为可编辑-->
                个人网站:<input type="url" value="www.baidu.com" disabled="disabled"> <br>  
               
                个人邮箱:<input type="email"><br>          <!--邮箱格式-->
              
                身体体重:<input type="number"><br>         <!--代表只能输入数字-->
             
                出生日期:<input type="date"><br>           <!--可选年月日-->
               
                详细时间:<input type="time"><br>            <!--time--代表显示时分-->
                
                隐藏项:   <input  type="hidden" value="你们看不到我"><br>     <!--这个隐藏标签有很大的作用,可以不显示在界面,但后台可以获取值-->
        
                <input type="button" value="填写完毕">     <!--普通的button按钮-->
                <input type="reset" value="重置信息">      <!--reset代表一按重置所以信息清空-->
                <input type="submit" value="完成注册">     <!--submi代表所以信息提交到后台,如果上面调用了onSubmit方法,那么返回为true才提交-->
                <input type="image" src="first.jpg" height="20" width="40">        <!--image也可以进行表单的提交-->
47         </fieldset>         
    </form>
</body>
</html>
Copy after login
The rendering is as follows:

##

The above is the detailed content of Detailed explanation of table tags in html. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Table Border in HTML Table Border in HTML Sep 04, 2024 pm 04:49 PM

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

HTML margin-left HTML margin-left Sep 04, 2024 pm 04:48 PM

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Nested Table in HTML Nested Table in HTML Sep 04, 2024 pm 04:49 PM

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

HTML Table Layout HTML Table Layout Sep 04, 2024 pm 04:54 PM

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

HTML Input Placeholder HTML Input Placeholder Sep 04, 2024 pm 04:54 PM

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

HTML Ordered List HTML Ordered List Sep 04, 2024 pm 04:43 PM

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Moving Text in HTML Moving Text in HTML Sep 04, 2024 pm 04:45 PM

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

HTML onclick Button HTML onclick Button Sep 04, 2024 pm 04:49 PM

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

See all articles