zoukankan      html  css  js  c++  java
  • Python Day14

    HTML

    HTML是英文Hyper Text Mark-up Language(超文本标记语言)的缩写,他是一种制作万维网页面标准语言(标记)。相当于定义统一的一套规则,大家都来遵守他,这样就可以让浏览器根据标记语言的规则去解释它。

    浏览器负责将标签翻译成用户“看得懂”的格式,呈现给用户!

    Doctype

    Doctype告诉浏览器使用什么样的html或xhtml规范来解析html文档

    有和无的区别
    • BackCompat:标准兼容模式未开启(或叫怪异模式[Quirks mode]、混杂模式)
    • CSS1Compat:标准兼容模式已开启(或叫严格模式[Standards mode/Strict mode])

    这个属性会被浏览器识别并使用,但是如果你的页面没有DOCTYPE的声明,那么compatMode默认就是BackCompat,这也就是恶魔的开始 -- 浏览器按照自己的方式解析渲染页面,那么,在不同的浏览器就会显示不同的样式。如果你的页面添加了那么,那么就等同于开启了标准模式,那么浏览器就得老老实实的按照W3C的标准解析渲染页面,这样一来,你的页面在所有的浏览器里显示的就都是一个样子了。

    Doctype告诉浏览器使用什么样的html或xhtml规范来解析html文档, dtd文件则包含了标记、attributes 、properties、约束规则。

    Meta(metadata information)

    提供有关页面的元信息,例:页面编码、刷新、跳转、针对搜索引擎和更新频度的描述和关键词

    1.页面编码(告诉浏览器是什么编码)

    < meta http-equiv=“content-type” content=“text/html;charset=utf-8”>

    2.刷新和跳转

    < meta http-equiv=“Refresh” Content=“30″>

    < meta http-equiv=”Refresh“ Content=”5; Url=http://www.autohome.com.cn“ />

    3.关键词

    < meta name="keywords" content="星际2,星际老男孩,专访,F91,小色,JOY" >

    4.描述

    例如:cnblogs

    5.X-UA-Compatible

    微软的IE6是通过XP、Win2003等操作系统发布出来,作为占统治地位的桌面操作系统,也使得IE占据了通知地位,许多的网站开发的时候,就按照IE6的标准去开发,而IE6自身的标准也是微软公司内部定义的。到了IE7出来的时候,采用了微软公司内部标准以及部分W3C的标准,这个时候许多网站升级到IE7的时候,就比较痛苦,很多代码必须调整后,才能够正常的运行。而到了微软的IE8这个版本,基本上把微软内部自己定义的标准抛弃了,而全面的支持W3C的标准,由于基于对标准彻底的变化了,使得原先在早期IE8版本上能够访问的网站,在IE8中无法正常的访问,会出现一些排版错乱、文字重叠,显示不全等各种兼容性错误。

    与任何早期浏览器版本相比,Internet Explorer 8 对行业标准提供了更加紧密的支持。 因此,针对旧版本的浏览器设计的站点可能不会按预期显示。 为了帮助减轻任何问题,Internet Explorer 8 引入了文档兼容性的概念,从而允许您指定站点所支持的 Internet Explorer 版本。 文档兼容性在 Internet Explorer 8 中添加了新的模式;这些模式将告诉浏览器如何解释和呈现网站。 如果您的站点在 Internet Explorer 8 中无法正确显示,则可以更新该站点以支持最新的 Web 标准(首选方式),也可以强制 Internet Explorer 8 按照在旧版本的浏览器中查看站点的方式来显示内容。 通过使用 meta 元素将 X-UA-Compatible 标头添加到网页中,可以实现这一点。

    当 Internet Explorer 8 遇到未包含 X-UA-Compatible 标头的网页时,它将使用 指令来确定如何显示该网页。 如果该指令丢失或未指定基于标准的文档类型,则 Internet Explorer 8 将以 IE5 模式(Quirks 模式)显示该网页

    Title

    网页头部信息

    常用标签

    标签一般分为两种:块级标签 和 行内标签

    • 行内标签: span(白板)等
    • 块级标签:div(白板),H系列(加大加粗),p标签(段落和段落之间有间距)等

    p标签表示段落,默认段落之间是有间隔的!

    br 标签是换行

    a标签

    < a href="http://www.autohome.com.cn">

    1、target属性,_black表示在新的页面打开

    2、锚

    H标签
    <h1>最大的标题</h1>
    <h2> . . . </h2>
    <h3> . . . </h3>
    <h4> . . . </h4>
    <h5> . . . </h5>
    <h6>最小的标题</h6>
    
    图片(Images)
    <img src="URL" alt="替换文本" height="42" width="42">
    
    列表

    ul ol dl

    <ul>
        <li>line1</li>
        <li>line2</li>
        <li>line3</li>
    </ul>
    
    <ol>
        <li>line1</li>
        <li>line2</li>
        <li>line3</li>
    </ol>
    
    <dl>
        <dt>河北省</dt>
        <!--dt是标签,dd是标签里的内容-->
            <dd>石家庄</dd>
            <dd>衡水市</dd>
        <dt>山东省</dt>
        <!--dt是标签,dd是标签里的内容-->
            <dd>济南市</dd>
            <dd>烟台市</dd>
    </dl>
    
    表格

    table

    <table border="1">
        <thead>
        <!--表头-->
            <tr>
                <th>表1</th>
                <th>表2</th>
                <th>表3</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
            </tr>
                <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
            </tr>
                <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
            </tr>
        </tbody>
    </table>
    

    横向合并单元格:colspan = ''

    纵向合并单元格:rowspan = ''

    select 标签

    单选菜单

    <select>
        <option value="1">北京</option>
        <option value="2">上海</option>
        <option value="3" selected="selected">深圳</option>
        <!--selected="selected"表示默认选择深圳-->
    </select>
    

    多选菜单

    <select multiple="multiple" size="3">
        <option>香港</option>
        <option>北京</option>
        <option>上海</option>
        <option>深圳</option>
    </select>
    
    input 系列标签
    单选框(radio)

    radio 标签只有当 name 值相同时它们才会互斥,才是真正的单选框;

    <!--对于input标签来说只要,radio的name值相同,那么他们就会互斥-->
    <p>请选择性别:</p>
    男:<input type="radio" name="gender" value="1" />
    女:<input type="radio" name="gender" value="2" />
    
    复选框(checkbox)
    <p>请选择体育爱好:</p>
    篮球:<input type="checkbox" name="favor" value="1">
    足球:<input type="checkbox" name="favor" value="1">
    乒乓球:<input type="checkbox" name="favor" value="1" checked="checked">
    羽毛球:<input type="checkbox" name="favor" value="1" checked="checked">
    <!--这里加一个标识checked="checked,为默认选择"-->
    
    输入框(text & password)
    <!--标准的输入框-->
    <input type="text"/>
    <!--密码的输入框(输入的内容是保密的)-->
    <input type="password"/>
    
    提交按钮(button & submit & reset)
    <!--普通的按钮-->
    <input type="button" value="提交"/>
    <!--带提交表单功能的按钮?-->
    <input type="submit" value="提交"/>
    <!--重置按钮,清空所有输入的数据-->
    <input type="reset"  value="重置" />
    
    提交文件(file)
    <input type="file" name="fname"/>
    
    多行文本框(textarea)
    <textarea style="height: 100px; 100px;"></textarea>
    

    form 表单

    input系列需要通过form表单才能提交数据

    <form action="http://localhost:8888/index" method="get">
        <!--这里action是告诉html提交到那里-->
        <!--method是通过什么方法去action指定的地址-->
        <!--表单会把所有获取输入的数据存成一个json提交到后台-->
        <input type="text" name="user" />
        <input type="text" name="email" />
        <input type="password" name="pwd" />
        <input type="button" value="button1" />
        <input type="submit" value="提交"/>
        <!--这里按提交才有反映,submit是用来提交当前的表单的,当然可以有多个表单-->
        <!--但是,这个submit需要写入表单内,那么提交的时候是提交的当前表单-->
    </form>
    
    lable 标签

    使用label标签的时,选择文字就会进入到相应的框体,他类似一个跳转

    <label for="username">用户名:</label>
    <input id="username" type="text" name="user" />
    <br />
    <label for="pwd">密码:</label>
    <input id="pwd" type="text" name="user" />
    
    各种符号:

    http://www.cnblogs.com/web-d/archive/2010/04/16/1713298.html

    CSS

    css是英文Cascading Style Sheets的缩写,称为层叠样式表,用于对页面进行美化。

    存在方式有三种:元素内联、页面嵌入和外部引入,比较三种方式的优缺点。

    • 在标签中使用 style='xx:xxx;'
    • 在页面中嵌入 < style type="text/css"> 块
    • 引入外部css文件

    必要性:美工会对页面的色彩搭配和图片的美化负责,开发人员则必须知道是如何实现的。

    标签选择器
    div{ background-color:red; } 
    <div > </div>
    
    class选择器
    .bd{ background-color:red; } 
    <div class='bd'> </div>
    
    id选择器
    #idselect{ background-color:red; } 
    <div id='idselect' > </div>
    
    关联选择器
    #idselect p{ background-color:red; } 
    <div id='idselect' > <p> </p> </div>
    
    组合选择器
    input,div,p{ background-color:red; } 
    
    属性选择器
    input[type='text']{ 100px; height:200px; } 
    
    css样式也可以写在单独文件中
    注释

    /* 内容 */

    边框

    宽度,样式,颜色 (border: 4px dotted(虚线)solid(实线) red)

    • height, 高度 可以写像素或百分比(百分比没有意义)
    • width 宽度 可以写像素或百分比
    • text-align:ceter, 水平方向居中
    • line-height,垂直方向根据标签高度
    • color 字体颜色
    • font-size 字体大小
    • font-weight 字体加粗
    float 浮动
    • float="left" 向左飘
    • float="left" 向右飘
    • 当父级管不住:
    display
    • display: none; 让标签消失
    • display: inline; 块级标签转为行内标签
    • display: block; 行内标签转为块级标签
    • display: inline-block; 具有inline,默认自己有多少占多少,具有block,可以设置无法设置高度,宽度,padding margin
    • 行内标签:无法设置高度,宽度,padding margin
    • 块级标签:可以设置高度,宽度,padding margin
    margin(外边距)
    /*外边距从上往下移50px*/
    margin-top: 50px;
    /*外边距从左往右移50px*/
    margin-left: 50px;
    
    padding(内边距)
    /*内边距从上往下移50px*/
    padding-top: 50px;
    /*内边距从左往右移50px*/
    padding-left: 50px;
    
  • 相关阅读:
    引用类型中的push()、pop()、shift()方法
    SQL Server ->>监控和管理Tempdb
    SQL Server ->> 与SQL Server服务配置相关的DMV
    SQL Server ->> 深入探讨SQL Server 2016新特性之 --- Temporal Table(历史表)
    SQL Server ->> 深入探讨SQL Server 2016新特性之 --- Row-Level Security(行级别安全控制)
    SQL Server ->> SQL Server 2016新特性之 -- sp_set_session_context存储过程和SESSION_CONTEXT函数
    SQL Server ->> Enable Instant File Initialization(开启文件及时初始化)
    SQL Server ->> 尝试优化ETL中优化Merge性能
    SQL Server ->> 校检函数CHECKSUM、CHECKSUM_AGG、BINARY_CHECKSUM和HASHBYTES
    SQL Server ->> Database Promgramming Object Security Control(数据库编程对象安全控制)
  • 原文地址:https://www.cnblogs.com/shaolin2016/p/6049281.html
Copyright © 2011-2022 走看看