• HTML、XHTML、css速记


    一、HTML

    下面内容记录经常使用的html元素。可另存为html文件以查看效果:

    <!doctype html>

    <html lang="zh-cn">

     <head>

     <!--meta属性提供页面元信息,不显示-->

     <meta charset="UTF-8">

     <meta name="Generator" content="EditPlus"/>

     <meta name="Author" content="zjc"/>

     <meta name="Keywords"content="HTML,XHTML,css"/>

     <meta name="Description" content="经常使用元素速记表"/>

     <title>HTML Demo</title>

     </head>

     <body>

            <h1>h1—h6定义标题</h1>

            <p>p标记定义段落,浏览器显示时会自己主动换行</p>

            <br/>(换行)

            <hr/>(切割线)

            <pre>原始样式输出,比方保留空   格

                    换行

                           及缩进</pre>

            <strong>加强显示。类似粗体文字</strong>

            <i>斜体文字</i>

            <b>粗体文字</b>

            <a href="http://www.126.com/">文字链接</a>

            <a href="http://www.126.com/" target="_blank"><img src="URL" alt="图片链接"></a>

            <a name="书签">定义页面的书签(位置)</a>

            <a href="#书签">跳转到那个书签(位置)</a>

            <ul>

                    <li>无序号列表-条目1</li>

                    <li>无序号列表-条目2</li>

            </ul>

            <ol type="A">

                    <li>有序号列表-条目A</li>

                    <li>有序号列表-条目B</li>

            </ol>

            <dl>

                    <dt>自己定义列表项目1</dt>

                           <dd>条目1-1</dd>

                           <dd>条目1-2</dd>

                    <dt>自己定义列表项目2</dt>

                           <dd>条目2-1</dd>

                           <dd>条目2-2</dd>

            </dl>

            <table border="1">

                    <tr>

                      <th colspan="2">表格标题行</th>

                    </tr>

                    <tr>

                      <td>一行第1列</td>

                      <td>一行第2列</td>

                    </tr>

                    <tr>

                      <td>二行第1列</td>

                      <td>二行第2列</td>

                    </tr>

            </table>

            <div class="main" style=color:#ff0000"><p>div是区块/小节 定义。浏览器显示时会自己主动换行。

    section、div、header、footer等标签通经常使用于页面布局。class、id能够为外部样式表预设标识</p></div>

            <p>段内<span id="important" style="color:#00ff00">布局元素</span>,可使用css单独对此部分文字进行修饰</p>

            <form action="this.jsp" method="post/get">

                    <input type="text" name="lastname" value="zjc"size="20" maxlength="50">

                    <input type="password"><br/>

                    <input type="checkbox" checked="checked">Married<br/>

                    <input type="radio" name="sex" value="Male"checked="checked">Male<br/>

                    <input type="radio" name="sex"value="Female">Female<br/>

                    <input type="hidden">

                    <select>

                           <option>程序猿

                           <option selected>project师

                           <option>销售

                    </select>

                    <br/>

                    <textarea name="Comment" rows="2"cols="20"></textarea><br/>

                    <input type="submit" value="提交表单">

                    <input type="reset" value="清除全部">

            </form>

     </body>

    </html>

    下面是html框架(frame)演示样例——因为frame实际上是多个文件的组合,所以在运行脚本、页面刷新等操作时往往出现意外结果,如今用的不多。大部分站点採用div区块布局达到类似的“排版”效果。

    <!doctype html>

    <html lang="en">

     <head>

     <title>Frame Demo</title>

     </head>

     <frameset rows="20%,80%">

            <frame src="/frame/title.html" noresize="noresize">

            <frameset cols="25%,75%">

                    <frame src="/frame/menu.html">

                    <frame src="/frame/content.html">

            </frameset>

     </frameset>

     <!--使用框架,就不能带body节点了,带了也显示不了。

     <body>

            iframe是内联框架,相当于在某个区域嵌入另外一个html页面。是写在body内的,但不是全部浏览器都支持。

             <iframe src="/test.html"width="200" height="200" frameborder="0"></iframe>

     </body>

     -->

    </html>

    二、XHTML

    XHTML 指的是可扩展超文本标记语言;XHTML 与 HTML 4.01 差点儿是同样。XHTML 是更严格更纯净的HTML 版本号。XHTML 是以 XML 应用的方式定义的 HTML。XHTML 是 W3C 推荐标准。

    依据以上定义,能够看出xhtml和普通html差别仅在于格式更规范。

    比如:

    必需拥有根元素(<html>)

    元素必须正确嵌套

    元素必须始终关闭

    元素、属性必须小写

    属性值必须用引號、不能简写

    三、css

    css(层叠样式表)用于在分离的文件里对html内容进行外观修饰。提供了丰富的功能以满足多种视觉效果。css最基本格式为:选择器{属性:值;属性:值;......}

    如:h1 {color:red;font-size:10px}

    div.main,span#important{color:green}

    body table {font-size:10px}

    总结:html/xhtml、css、javascript是非常自然的mvc架构,html是内容;css是展示;javascript是控制。这也是眼下站点所用的主流技术组合,非常多前端技术框架也是基于三者来完毕的。
  • 相关阅读:
    [LeetCode] Coin Change
    [LeetCode] House Robber
    [LeetCode] Lowest Common Ancestor of a Binary Search Tree
    [LeetCode] Remove Element
    [LeetCode] Merge Two Sorted Lists
    [LeetCode] Duplicate Emails
    svn propset svn:ignore
    WebLogic11g-负载分发
    WebLogic11g-集群相关概念
    WebLogic11g-半小时让你的domain集群化
  • 原文地址:https://www.cnblogs.com/liguangsunls/p/7028010.html
Copyright © 2020-2023  润新知