1.html

一、排版标签:

    h1-h6:标题从大到小
    <h4>a</h4><br/> 换行
    <hr>    分割线
    <p>b</p>b   换行
    <marquee behavior="" direction="right">hello</marquee>  字体飘过

二、html常用标签之列表:

1、无序列表

    <ul type="circle">
        <li>haha</li>
        <li>haha</li>
    </ul>

type属性:disc(实心圆点,默认) cricle(空心圆点) square(实心方块)

2、有序列表

    <ol type="I">
        <li>enen</li>
        <li>enen</li>
    </ol>

type属性:编号类型,默认整数,可选(1,A,a,I,i)
start属性:起始编号,默认1

三、a标签

 <a href="http://www.baidu.com" target="_blank">跳转到百度</a><br>
 <a href="1.html">跳转当前目录的html</a>
 <a href="mailto:2020329697@qq.com">连接打邮箱</a>
 <a href="1.py">下载1.py</a>

target:
_blank在新窗口打开目标网页;
_self在当前窗口打开目标网页

四、img

<img src="tupian.png" alt="找不到这个图片" height="500" width="500">

属性:
src-图像url-规定图像的url
alt-字符串-固定图像的替代文本
width-px/%-规定图像的宽
height-px/%-规定图像的高
border-px-图像的边框粗细

五、div和span

<div style='background-color:red;'>hello</div>
<span style='background-color:yellow;'>hello</span>

属性:
div:块级元素,是以另起一行渲染的元素
span:行内元素,不需另起一行
都没有实际意义,主要通过css为其赋予不同的表现。

六、table

 <table border="1px" width="500px">
        <tr>
            <th>用户名</th>
            <th>密码</th>
            <th>年龄</th>
        </tr>
        <tr>
            <td>1</td>
            <td>2</td>
            <td>3</td>
        </tr>
        <tr>
            <td>1</td>
            <td>2</td>
            <td>3</td>
        </tr>
</table>

解释:

    <table></table> 表示表格的开始和结束
    <tr></tr>   表示表格的一行
    <td></td>   表示一个单元数据格
    <th></th>   表示表格标题单元格,且加粗居中显示

属性:

    width-px/%  表格的宽度
    height-px/% 表格的高度
    border-px   表格的边框的粗细
    align-Left/center/right 元素的对齐方式

七、form(app.py)

py:pip3 install tornado 轻量级jango框架

import tornado.ioloop
import tornado.web

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        username=self.get_argument('username')
        salary=self.get_argument('salary')
        print(username,salary)
        self.write("Hello,world")

    def post(self):
        username = self.get_argument('username')
        salary = self.get_argument('salary')
        print(username,salary)

        hobby=self.get_arguments('hobby')
        print(hobby)

        gender=self.get_arguments('gender')
        print(gender)
        self.write('this is a test')

application=tornado.web.Application([
    (r"/index",MainHandler),
])

if __name__ == '__main__':
    application.listen(8888)
    tornado.ioloop.IOLoop.instance().start()

html:

   <form action="http://localhost:8888/index" method="post" enctype="multipart/form-data">
        用户名:<input type="text" name="username" placeholder="用户名">
        密码:<input type="password" name="password" placeholder="密码">
        <input type="button" value="普通按钮">
        <input type="submit" value="提交数据">
        <input type="reset" value="重置">
        <input type="hidden" value="800" name="salary"><br>
        <input type="file" ><br>

        足球:<input type="checkbox" name="hobby" value="football">
        篮球:<input type="checkbox" name="hobby" value="basketball" checked>
        排球:<input type="checkbox" name="hobby" value="paiqiu"><br>

        male:<input type="radio" name="gender" value="male" checked>
        female:<input type="radio" name="gender" value="female"><br>

        选择城市:<select name="city" id="city">
            <option value="bj">北京</option>
            <option value="sh" selected>上海</option>
            <option value="gz">广州</option>
        </select>
        <br>
        <textarea name="question" id="question" cols="30" rows="10">
            默认内容
        </textarea><br>

        <label for="username">用户名</label>
        <input type="text" name="username" id="username">

    </form>

属性:
text:单行文本输入框,name服务端获取数据的名字,placeholder浮现在表单格里
password:密码输入框,不可见的
button:普通按钮
submit:提交按钮
reset:重置按钮
hidden:隐藏按钮,页面上不可见,但是服务端可以获取到
file:文本选择框,
注意:必须指定MINE类型enctype="multipart/form-data,只在method="post"有效
checkbox;复选框,checked默认选择
radio:单选框
select:下拉列表

  • multiple:设置后允许多选
  • disabled:禁止改下拉列表
  • selected:首次显示时,为选中状态
  • value:定义发忘服务器的选项值

textarea:多行文本框

  • name:空件名称
  • rows:设置显示行数(高度)
  • cols:设置显示高度(宽度)
  • disabled:布尔属性,禁用文本框

lable:表单修饰,不会呈现特殊效果,for属性应该与相关元素的id属性相同,结合css可以控制表单文本与控件对齐,美化表单。

原文地址:https://www.cnblogs.com/yangjianan/p/10522321.html