一篇文章了解HTML5

2018-03-07  本文已影响0人  奥之

一篇文章了解HTML5

市面上的html5教程冗长且难于理解,实际上html5是一门非常容易入门的语言,本篇文章让你初步了解html5,进入建立网站的大门

认识基本结构

<!DOCTYPE html>
<!-- 这个是头文件 -->
<html>          
<!-- 这个是html的标志 -->
<head>          
<!-- 这儿填你需要引入的文件,以后再讲 -->
  <meta charset="utf-8">
  <!-- 这个理解为引入的字符 -->
  <title></title>
  <!-- 两个title之间可以填入网站的名字 -->
</head>
<body>          
<!-- body,顾名思义,网页的主体 -->

<h1>认识h5基本结构</h1>
<p>两个p之间可以插入文字,也就是段落</p>

</body>
<!-- 结束网页内容 -->
</html>


处理文字

 <p>This is a paragraph.</p>
 <mark>我是被高亮的部分</mark>
<b>Bold Text Here</b>
<i>Italicized Text Here</i>
<em>Italicized Text Here</em>
<u>mispelled</u>
<abbr title="Hypertext Markup Language">HTML</abbr>
<del>Deleted Text</del>
<ins>New Text</ins>
<sup>superscript here</sup>
<!-- 这是上标 -->
<sub>subscript here</sub>
<!-- 这是下标 -->

处理链接

<a href="https://我的网站地址">我想去的网站</a>
<h2 id="Topic1">First topic</h2>
<p>Content about the first topic</p>
<h2 id="Topic2">Second topic</h2>
<p>Content about the second topic</p>
<h1>Table of Contents</h1>
<a href='#Topic1'>Click to jump to the First Topic</a>
<a href='#Topic2'>Click to jump to the Second Topic</a>
<a href="tel:1234567890">Call us</a>

当有用户点击上面这行代码的时候,他的设备会为他自动跳转电话界面

<a href="example.com" target="_blank">Text Here</a>

<a href="javascript:myFunction();">Run Code</a>
<a href="#" onclick="myFunction(); return false;">Run Code</a>

<a href="#!" onclick="myFunction();">Run Code</a>
<a href="邮箱地址:example@example.com">Send email</a>

<a href="邮箱地址:example@example.com?cc=example2@example.com&bcc=example2@example.com">Send email</a>
<a href="邮件地址:example@example.com?subject=主题&body=内容">Send email</a>

处理列表

在网页中肯定会有用到列表的时候,那么用h5该怎么去表示呢?

<ol>
<li>Item</li>
<li>Another Item</li> <li>Yet Another Item</li>
</ol>

这个在网页中的显示效果大致如下

  1. Item
  2. Another Item
  3. Yet Another Item
<ol start="你希望列表开始的数字">

<ul>
<li>Item</li>
<li>Another Item</li> <li>Yet Another Item</li>
</ul>

<ul>
<li>item 1</li> <li>item 2
<ul>
<li>sub-item 2.1</li> <li>sub-item 2.2</li>
</ul> </li>
<li>item 3</li> </ul>

表格

在网页中也有需要用到表格的地方,毕竟你总不能直接截个Excel之类的软件的图放在网页上吧

<table> <tr>
<th>Heading 1/Column 1</th>
<th>Heading 2/Column 2</th> </tr>
<tr>
<td>Row 1 Data Column 1</td> <td>Row 1 Data Column 2</td>
</tr> <tr>
<td>Row 2 Data Column 1</td>
<td>Row 2 Data Column 2</td> </tr>
</table>
<table> <tr>
<td>row 1 col 1</td> <td>row 1 col 2</td> <td>row 1 col 3</td>
</tr> <tr>
<td colspan="3">This second row spans all three columns</td> </tr>
<tr>
<td rowspan="2">This cell spans two rows</td> <td>row 3 col 2</td>
<td>row 3 col 3</td>
</tr> <tr>
<td>row 4 col 2</td>
<td>row 4 col 3</td> </tr>
</table>
<table>
<colgroup span="2"></colgroup> <colgroup span="2"></colgroup> ...
</table>

当然我觉得h5自带的表格样式其实挺不好用的,表格相关的我们到了css再说

插入图片和视频

<img src="图片地址及名字" alt="图片名字"style="width:宽度数字px;height:高度数字px;>

<video width="320" height="240" controls>
<!-- 高度和宽度 -->
  <source src="视频名字" type="video/mp4">
</video>

关于html5最最最基本的东西基本就是这些,了解后可以轻松编写一些简单的网页,但是如果想要做好一个网站,还是需要css和js的帮助.

上一篇 下一篇

猜你喜欢

热点阅读