zoukankan      html  css  js  c++  java
  • html开发基础

     1 Doctype
     2 
     3   Doctype告诉浏览器使用什么样的html或xhtml规范来解析html文档
     4 
     5 有和无的区别
     6 
     7   BackCompat:标准兼容模式未开启(或叫怪异模式[Quirks mode]、混杂模式)
     8 
     9   CSS1Compat:标准兼容模式已开启(或叫严格模式[Standards mode/Strict mode])
    10 
    11   这个属性会被浏览器识别并使用,但是如果你的页面没有DOCTYPE的声明,那么compatMode默认就是BackCompat,这也就是恶魔的开始 -- 浏览器按照自己的方式解析渲染页面,那么,在不同的浏览器就会显示不同的样式。如果你的页面添加了那么,那么就等同于开启了标准模式,那么浏览器就得老老实实的按照W3C的标准解析渲染页面,这样一来,你的页面在所有的浏览器里显示的就都是一个样子了。
    12 
    13 功能14 
    15   Doctype告诉浏览器使用什么样的html或xhtml规范来解析html文档, dtd文件则包含了标记、attributes 、properties、约束规则。
    16 
    17   Meta(metadata information)
    18 
    19   提供有关页面的元信息,例:页面编码、刷新、跳转、针对搜索引擎和更新频度的描述和关键词

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

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

    刷新和跳转

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

    关键词

    < meta name="keywords" content="专访,11,43" >

    X-UA-Compatible

    与任何早期浏览器版本相比,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 模式)显示该网页。更多
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

    Title网页头部信息

    Link
    1.css
    < link rel="stylesheet" type="text/css" href="css/common.css" >
    2.icon
    < link rel="shortcut icon" href="image/favicon.ico">
    Style
    在页面中写样式
    例如:
    < style type="text/css" >
    .bb{
          background-color: red;
       }
    < /style>
    Script
    引进文件
    < script type="text/javascript" src="http://www.googletagservices.com/tag/js/gpt.js"> </script >
     
    写js代码
    < script type="text/javascript" > ... </script >

    常用标签

    标签一般分为两种:块级标签和行内标签
    行内标签:a、span、select 等#页面展示的时候是一整行
    块级标签:div、h1、p 等#页面展示的时候是一整块
    
    各种符号 http://www.cnblogs.com/web-d/archive/2010/04/16/1713298.html
    因为类似<div>这个是不可以直接显示出来的,所以需要通过特定的符号来展示 &lt;div &gt;

    p 和 br p表示段落,默认段落之间是有间隔的! br 是换行
     
    a标签
    < a href="http://www.autohome.com.cn"> </a>
    1、target属性,_blank表示在新的页面打开
    2、锚
    H 标签
    H1 H2 H3 H4  H5  H6
    select 标签
    <select>
             <option value='1'>上海</option>
             <option value='2'>北京</option>
             <option value='3' selected='selected'>广州</option>      selected='selected'表示模式选中,而value所定义的值是用来提交给后台进行数据操作的,提交1就表示是上海
    </select>
     
    <select multiple="multiple" size='2'>  multiple 表示可以多选  size 规定下拉列表中可见选项的数目
    <optgroup> 标签可以把相关的选项组合在一起,label 为选项组规定描述,分组的功能
    <select>
             <optgroup label='河北省'>
                      <option>石家庄</option>
                      <option>邯郸</option>
             </optgroup>
             <optgroup label='山西省'>
                      <option>太原</option>
                      <option>平遥</option>
             </optgroup>
    </select>
    <input type = "checkbox/radio/text/password/button/submit/file" name='xx' />
    Checkbox  复选框
    radio       单选框     在单选框中,如果需要互斥的属性,需要将name设置为同一个
    text    文本框
    password  密码框
    button     按钮
    submit     提交按钮 会提交数据
    file  上传文件  提交文件时: enctype='multipart/form-data' method='POST'
    多行输入的文本框
    <
    textarea>asdjoifjwe</textarea>
    <form action='后台url' method='POST'>
                    NAME:<input name='username' type='txt'/>
                    <br/>
                    pwd:<input  name='paswd' type='password'/>    
                    <input type='button' onclick='alert(123) 'value='提交'/>
                    <input type='submit' value='提交'/>
    </form>

    name主要就是为了让后台获取值
    只要我的光标到了这一行会自动定位到文本框里面
    <
    label for='name2'>姓名:<input id='name2' type='txt'/></label>
    三种列表样式 
     <
    ul> <li>ul.li</li> <li>ul.li</li> <li>ul.li</li>

      </ul>   <ol> <li>ul.li</li> <li>ul.li</li> <li>ul.li</li>   </ol>   <dl> <dt>江苏</dt> <dd>南通</dd> <dd>苏州</dd> <dt>北京</dt> <dd>北京</dd>   </dl>

    表格

        <table>
                <tr>
                    <td>1</td>
                    <td>2</td>
                </tr>
                <tr>
                    <td>2</td>
                    <td>3</td>
                </tr>
        </table>    
        <table border='1'> border标签
                <tr>
                    <th>1</th>  标题th
                    <th>2</th>
                </tr>
                <tr>
                    <td>1</td>
                    <td>2</td>
                </tr>
                <tr>
                    <td>2</td>
                    <td>3</td>
                </tr>
            </table>    

    colspan='2'合并行
    rowspan='2'合并列
    样式
    <
    fieldset> <legend>登录</legend> <p>用户名:</p> <p>密码:</p> </fieldset>

     实例:

      1 <!DOCTYPE html>
      2 <html>
      3     <head>
      4         <meta http-equiv=“content-type” content=“text/html;charset=utf-8”>
      5         <title>页面一</title>
      6     </head>
      7     
      8     <body>
      9         
     10         <h1>哈哈</h1>
     11         <div>&lt;div&gt;</div>
     12         <div>bill</div>
     13         <div>bill</div>
     14         <span>shaobing</span>
     15         <span>shaobing</span>
     16         <p>ninini &nbsp; nnnnnnmn</p>
     17         <p>fsdfwejoifjsdafwen <br/>fsdfewf wefsadf</p>
     18         <a href='http://www.baidu.com' target='_blank'>bill</a>
     19         
     20         目录:
     21         <div>
     22             <a href='#id1'>第一章</a>
     23             <a href='#id2'>第二章</a>
     24             <a href='#id3'>第三章</a>
     25         </div>
     26         内容:
     27         <div id='id1'>第一章内容</div>
     28         <div id='id2' style='height:1000px;background-color:red'>第二章内容</div>
     29         <div id='id3'>第三章内容</div>
     30         
     31         
     32         <select>
     33          <option value='1'>上海</option>
     34          <option value='2'>北京</option>
     35          <option value='3' selected='selected'>广州</option>
     36         </select>
     37         
     38         
     39         
     40         <select>
     41                 <optgroup label='河北省'>
     42                     <option>石家庄</option>
     43                     <option>邯郸</option>
     44                 </optgroup>
     45                 <optgroup label='山西省'>
     46                     <option>太原</option>
     47                     <option>平遥</option>
     48                 </optgroup>
     49         </select>
     50         
     51         <input type='text'/>
     52         <input type='password'/>
     53         
     54         <input type='checkbox'/>
     55         <input type='checkbox'/>
     56         <input type='checkbox'/>
     57         <input type='checkbox'/>
     58         
     59         男:<input type='radio' name='nimei'/>
     60         女:<input type='radio' name='nimei'/>
     61         中:<input type='radio' name='nimei'/>
     62         <br/><br/><br/><br/><br/>
     63         <input type='button' value='提交'/>
     64         <input type='submit' value='提交'/>
     65 
     66         <br/><br/><br/><br/><br/>
     67         
     68         <input type='file' />
     69         <br/>
     70         
     71         <textarea>asdjoifjwe</textarea>
     72         <br/>
     73         
     74         <form action='后台url' method='POST'>
     75                 NAME:<input name='username' type='txt'/>
     76                 <br/>
     77                 pwd:<input  name='paswd' type='password'/>    
     78                 <input type='button' onclick='alert(123) 'value='提交'/>
     79                 <input type='submit' value='提交'/>
     80         </form>
     81         
     82         
     83         <br/><br/><br/>
     84         <label for='name2'>姓名:<input id='name2' type='txt'/></label>
     85         
     86         <ul>
     87             <li>ul.li</li>
     88             <li>ul.li</li>
     89             <li>ul.li</li>
     90         </ul>
     91         
     92         <ol>
     93             <li>ul.li</li>
     94             <li>ul.li</li>
     95             <li>ul.li</li>
     96         </ol>
     97         
     98         <dl>
     99             <dt>江苏</dt>
    100                 <dd>南通</dd>
    101                 <dd>苏州</dd>
    102             <dt>北京</dt>
    103                 <dd>北京</dd>
    104             
    105         </dl>
    106         
    107         <br/><br/><br/>
    108         
    109         <table border='1'>
    110             <tr>
    111                 <th>1</th>
    112                 <th>2</th>
    113             </tr>
    114             <tr>
    115                 <td>1</td>
    116                 <td>2</td>
    117             </tr>
    118             <tr>
    119                 <td>2</td>
    120                 <td>3</td>
    121             </tr>
    122         </table>    
    123             
    124             
    125         <br/><br/><br/>
    126         <table border='1'>
    127             <thead>
    128                 <tr>
    129                     <th>1</th>
    130                     <th>2</th>
    131                 </tr>
    132             </thead>
    133             <tbody>
    134                 <tr>
    135                     <td colspan='2'>1</td>
    136                     <td>2</td>
    137                 </tr>
    138                 <tr>
    139                     <td    rowspan='2'>1</td>
    140                     <td>2</td>
    141                 </tr>
    142                 <tr>
    143                     <td>2</td>
    144                     <td>3</td>
    145                 </tr>
    146             </tbody>
    147         </table>
    148         
    149         <br/><br/>
    150         
    151         <fieldset>
    152             <legend>登录</legend>
    153             <p>用户名:</p>
    154             <p>密码:</p>
    155         </fieldset>
    156     </body>
    157 
    158 </html>
  • 相关阅读:
    CodeForces Gym 100935G Board Game DFS
    CodeForces 493D Vasya and Chess 简单博弈
    CodeForces Gym 100935D Enormous Carpet 快速幂取模
    CodeForces Gym 100935E Pairs
    CodeForces Gym 100935C OCR (水
    CodeForces Gym 100935B Weird Cryptography
    HDU-敌兵布阵
    HDU-Minimum Inversion Number(最小逆序数)
    七月馒头
    非常可乐
  • 原文地址:https://www.cnblogs.com/bill2014/p/6920078.html
Copyright © 2011-2022 走看看