• 《网页设计基础——表格与表单》


    网页设计基础——表格与表单




    一、表格的基础框架;


    规则:

    1. table:表示整个表格
    2. caption:定义表格的标题
    3. tr:表示表格的一行。
    4. td:表示行中的一个列,需要嵌套在 标签内。
    5. th:表示表头单元格. 会居中加粗。

    格式:

    <table border="x">					
        <caption>标题caption>
        <tr>
        <th>th>
        <td>td>
        <td>td>
        tr>
    table>
    

    例如:

    <html>
    	<head>
    		<title>表格title>
    	head>
    	<body>
    		<table border="3">					
        		<caption>课程表caption>
        		<tr>
        			<th>th>
        			<th>Mondayth>
        			<th>Tuesdayth>
    				<th>Wednesdayth>
    				<th>Thursdayth>
    				<th>Fridayth>
        		tr>
    			<tr>
    				<th>第一节th>
    				<td>语文td>
    				<td>数学td>
    				<td>英语td>
    				<td>物理td>
    				<td>化学td>
    			tr>
    			<tr>
    				<th>第二节th>
    				<td>生物td>
    				<td>语文td>
    				<td>数学td>
    				<td>英语td>
    				<td>物理td>
    			tr>
    		table>
    	body>
    html>
    

    网页效果:

    PPG9U6M$)ZN9FQ1PK9_3833.png



    二、表格的常用样式;


    1.表格边框的合并与分离

    border-collapse: collapse;		/* 边框合并 */
    border-collapse: separate;		/* 边框分离 */
    

    2.表格边框的间距大小

    border-collapse: separate;		/* 边框分离 */
    border-spacing: 5px 10px		/* 横向 纵向*/
    

    3.表格标题的位置

    caption-side: top; 				/* 把标题放在表格上面。*/
    caption-side: bottom; 			/* 把标题放在表格下面。*/
    

    4.表头的标识

    <tr>
    	<th scope="col">星期一th>		
    	<th scope="col">星期二th>		
    tr>
    <tr>
    	<th scope="row">第一节th>			
        <td>语文td>									
    tr>
    


    三、表单的基础框架;


    规则:

    1. :定义供用户输入的表单标签。
    2. :输入标签。
    3. action属性:规定当提交表单时,向何处发送表单数据——用于动态网页,了解即可。
    4. method属性:规定发送表单数据的方式 【URL 变量(method="get")或者 HTTP post (method="post")】——用于动态网页,了解即可。
    5. type属性:定义输入类型,如文本域text、密码字段password、提交按钮submit
    6. name属性:定义表单的名称,用于在表单提交之后引用表单数据,或者在 JavaScript 中引用元素——用于动态网页,了解即可。
    7. placeholder属性:定义输入框中的提示信息。

    格式:

    <form>
        <input type="~~~" name="~~~" placeholder="~~~">
    form>
    

    例如:

    <html>
        <head>
        	<title>表单title>
        head>
        <body>
           <form>
                账号:<input type="text" name="user_acount" placeholder="请输入学号"><br>
                密码:<input type="password" name="user_password"><br>	    
                <input type="submit" value="提交">						
            form>
        body>
    html>
    

    网页效果:

    WQO1F{5%KHWB)0_KTTRUY.png



    四、表单的常用样式;


    例一:文本域(Text Fields)

    <html>
    	<head>
    		<title>文本域title>
    	head>
    	<body>
    		<form>
        		姓名:<input type="text" name="user_name"><br>
        		学号:<input type="text" name="user_id">
    		form>
    	body>
    html>
    

    网页效果:

    image.png


    例二:密码字段(Password)

    <html>
    	<head>
    		<title>密码字段title>
    	head>
    	<body>
    		<form>
        		账号:<input type="text" name="user_accound"><br>
        		密码:<input type="password" name="user_password">		
    		form>
    	body>
    html>
    

    网页效果:

    image.png


    例三:单选按钮(Radio Buttons)

    <html>
    	<head>
    		<title>表单title>
    	head>
    	<body>
    		<form>
        		<input type="radio" name="user_sex" value="Man"><br>	
        		<input type="radio" name="user_sex" value="Woman">form>
    	body>
    html>
    

    网页效果:

    image.png


    例四:复选框(Checkboxes)

    <html>
    	<head>
    		<title>表单title>
    	head>
    	<body>
    		<form>
        		<input type="checkbox" name="user_career" value="Programmer">我是程序员<br>	
        		<input type="checkbox" name="user_career" value="Superhero">我是超级英雄
    		form>
    	body>
    html>
    

    网页效果:

    image.png


    例五:下拉选择框(option)

    <html>
        <head>
            <title>表单——下拉选择框title>
        head>
        <body>
            <form>
                你喜欢的水果是:
                <select>
                    <option value="苹果">苹果option>
                    <option value="香蕉">香蕉option>
                    <option value="葡萄">葡萄option>
                select>
            form>
        body>
    html>
    

    网页效果:

    image.png


    例六:提交按钮(Submit)

    <html>
    	<head>
    		<title>表单title>
    	head>
    	<body>
    		<form>
    			<input type="text" name="user_name" placeholder="请输入姓名"><br>		
        		<input type="text" name="user_id" placeholder="请输入学号"><br>
        		<input type="submit" value="提交">
    		form>
    	body>
    html>
    

    网页效果:

    image.png

  • 相关阅读:
    Spring IOC - Bean的生命周期之依赖注入
    一套简单的机器人短途路径规划算法
    C# OPCUA 读写结构体
    针对遗留系统采取的不同演化策略
    【Kafka系列 06】Kafka Producer源码解析
    查分小程序,教学大作用
    单臂路由实现VLAN间路由
    (个人杂记)第九章 串口中断3
    Go基础学习笔记(二):错误处理和资源管理、Goroutine、Channel、迷宫的广度优先搜索、http及其他标准库
    SpringCloud-10-Eureka:注册服务提供者服务
  • 原文地址:https://www.cnblogs.com/Dustspirt/p/16701765.html