美文网首页
HTML基础

HTML基础

作者: Mango97 | 来源:发表于2018-10-19 18:52 被阅读4次

标题

<h1>---<h6>最小标题到最大标题

搜索引擎使用标题为您的网页的结构和内容编制索引。很重要!!

<hr>水平线

<br>换行

文本格式化标签

<b>定义粗体文字   

<em>定义着重文字        <strong>定义加重语气

<i>定义斜体字               <small>定义小体字

<sub>定义下标字           <sup>定义下标字

<ins>定义插入字             <del>定义删除字

<abbr>定义缩写              <abbr title="World Health Organization">WHO</abbr>

<address>定义地址         <code>定义代码

<bdo>定义文字方向        <bdo dir="rtl">该段落文字从右到左显示。</bdo>

链接

<a href="url"   target   id></a>    

target属性:你可以定义被链接的文档在何处显示 。target="_blank"表示在新窗口打开;(_blank、_parent、_self、_top)

id属性:用于创建在一个HTML文档书签标记。(书签是不以任何特殊的方式显示,在HTML文档中是不显示的,所以对于读者来说是隐藏的)

创建电子邮件链接

<a href="mailto:someone@example.com?Subject=Hello%20again" target="_top">

发送邮件</a>

(单词之间的空格需要使用%20来表示,以确保浏览器能真正解析空格)

使用锚跳转到页面的不同位置

<a id="top">这是标题,底部链接可以链接到这</a>

<a href="#top">链接到标题</a>

这样点击下面的就能回到上面的,就是常常遇到的跳转到顶部。

HTML头部

<head>

    <meta>

    <title></title>必须的

    <base>标签描述了基本的链接地址/链接目标,作为HTML文档中所有的链接标签的默认链接

    <style>定义了HTML文档的样式文件引用地址

    <link>定义了文档与外部资源之间的关系

              <link rel="stylesheet" type="text/css" href="mystyle.css">

    <script></script>标签用于加载脚本文件(一般是放在body末尾)

</head>

图像

<img title  alt  width  height>

title:当鼠标放在该图片上会显示相关信息

alt:当图片加载不出来会用里面的文字代替

width和height:设置图片的宽和高

创建图像地图:就是点击图像的某个位置跳转到另外一个图像。

<img src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap">

<map name="planetmap">

  <area shape="rect" coords="0,0,82,126" alt="Sun" href="sun.htm">

  <area shape="circle" coords="90,58,3" alt="Mercury" href="mercur.htm">

  <area shape="circle" coords="124,58,8" alt="Venus" href="venus.htm">

</map>

表格

<table border='1'>

<caption>Monthly savings</caption>   // caption带标题的表格

<tr>

    <td rowspan   colspan></td>或者是<th>Header 1</th> 

</tr>

</table>

边框属性borderH5只保留了这个属性

表格和表头(水平标题和垂直标题);

rowspan:竖跨n格;colspan:横跨n格

列表

<ol   type>有序列表    type="A/a/I/i//" 

<ul   style>无序列表   list-style-type

<li>列表项

<dl>自定义列表

<dt>Coffee</dt>  列表项

<dd>- black hot drink</dd>  列表项的描述

<dt>Milk</dt>

<dd>- white cold drink</dd>

</dl>

区块

大多数 HTML 元素被定义为块级元素内联元素。块级元素在浏览器显示时,通常会以新行来开始(和结束)<h1>, <p>, <ul>, <table>...。内联元素在显示时通常不会以新行开始<b>, <td>, <a>, <img>...。

表单和输入

<form action="html_form_action.php" method="get">

    <label for="male">Male</label>    为 input 元素定义标注

    <textarea>    定义文本域

    <select>   定义下拉列表

        <option value="volvo">Volvo</option>    定义选项

        <optgroup label="Swedish Cars">    定义选项组

                <option value="volvo">Volvo</option>

                <option value="saab">Saab</option>

        </optgroup>

    </select>

    <input  type="text">   文本框

    <input type="password">   密码框

    <input type="radio" value="male">    单选框

    <input type="checkbox" value="male">   复选框

    <button type="button">点我!</button>     定义点击按钮

    <button type="submit" value="提交">提交</button>

    <button type="reset" value="重置">重置</button> 

    <input type="submit">    提交按钮

</form>

当用户单击确认按钮时,表单的内容会被传送到另一个文件。表单的动作属性定义了目的文件的文件名。由动作属性定义的这个文件通常会对接收到的输入数据进行相关的处理。

H5新加表单标签

<input list="browsers" name="browser">

<datalist id="browsers">   描述了其可能的值

  <option value="Internet Explorer">

  <option value="Firefox">

  <option value="Chrome">

  <option value="Opera">

  <option value="Safari">

</datalist>

<form oninput="x.value=parseInt(a.value)+parseInt(b.value)">0

<input type="range" id="a" value="50">100

+<input type="number" id="b" value="50">

=<output name="x" for="a b"></output>   作为计算结果输出显示

</form>

框架

<ifram   src="url"   width   height   frameborder="0"  name="iframe_a">   frameborder=0移除边框

</iframe>

<a href="http://www.runoob.com" target="iframe_a"></a>   

通过name和target点击链接在iframe中显示页面

相关文章

网友评论

      本文标题:HTML基础

      本文链接:https://www.haomeiwen.com/subject/mufyzftx.html