HTML 命令

王林
发布: 2024-09-04 16:13:50
原创
918 人浏览过

HTML 的意思是超文本标记语言,是网页的标准标记语言。 HTML 将具有元素、属性和其他标签。互联网上的大多数网站都使用 HTML。 HTML 易于学习且功能强大。超文本是通过单击超链接在网络上移动的主要方法,超链接会重定向到另一个页面。标记通过将测试标记为某种类型,使用 HTML 标记显示其中的文本。 HTML Command 元素是 HTML 页面的构建块,可以具有提供有关该元素的附加信息的属性,并且属性将成对出现。

基本 HTML 命令

基本命令如下:

1. HTML 文档语法示例

示例 HTML 文档将包含作为网页构建块的 HTML 元素,其中一些 HTML 元素是 (根元素)、 等。其中将包含元信息,

其中包含文档的标题和 其中包括文档的数据。

代码:

html>

<meta>
<title>Page Title</title>

<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

登录后复制

输出:

HTML 命令

2. HTML 标题

HTML 标题是用标签

定义的 HTML 元素。到

其中

定义最重要的标签和

定义不太重要的标签。

示例 HTML 代码,标题如下:

<h1> This is heading 1 </h1>
<h2> This is heading 2 </h2>
<h3> This is heading 3 </h3>
<h4> This is heading 4 </h4>
登录后复制

输出:

HTML 命令

3. HTML元素段落

HTML 段落是我们使用

定义的 HTML 元素。标签,示例代码如下:

<p> This is a paragraph </p>
<p> This is another paragraph </p>
登录后复制

输出:

HTML 命令

4. HTML 图像

HTML图像是用标签HTML 命令定义的HTML元素,我们需要提及图像的src等属性,alt表示替代文本,要显示的图像的宽度和高度,示例代码是

代码:

<img src="HTML%20%E5%91%BD%E4%BB%A4.jpg" alt="HTML 命令"   style="max-width:90%">
登录后复制

输出:

HTML 命令

5. Html 列表

HTML 列表是一个 HTML 元素,使用标签

    定义。或
    其中
    是一个无序列表并且
    ;是一个有序列表

    代码:

    登录后复制
    登录后复制
  • Coffee
  • Tea
  • Milk

输出:

HTML 命令

6.创建表

HTML table 是一个 HTML 元素,可以使用标签

来定义它。以及带有标签 的行以及带有标签
的单元格代码如下:

代码:

登录后复制
登录后复制
Firstname Lastname Age
Jill Smith 50

输出:

HTML 命令

7.提及链接

HTML 链接是 HTML 元素,可以使用标签 来定义它们。示例代码如下:

代码:

<a href="https://www.HTML%20%E5%91%BD%E4%BB%A4.com">This is a link </a>
登录后复制

输出:

HTML 命令

8.样式属性

HTML属性样式可以与

等任意HTML元素组合使用,示例代码如下:

代码:

<p style="color:red"> I am a paragraph </p>
登录后复制

输出:

HTML 命令

9. lang 属性

在 HTML 中,使用 lang 属性,我们可以使用 声明文档的语言。标签,语言使用 lang 属性定义,示例代码如下:

代码:



...
...

登录后复制

输出:

HTML 命令

10。设置 HTML 元素的格式

在HTML中,我们可以使用格式化元素来格式化HTML文档,并且我们可以为具有特殊含义的文本定义特殊元素。 HTML 元素如 对于粗体,;斜体

代码:

<b> This text is bold. </b>
登录后复制

输出:

HTML 命令

中级 HTML 命令

中间命令如下:

1.突出显示文本

在 HTML 中,我们可以使用元素 突出显示 HTML 文档中的某些文本。以便它突出显示 中包含的文本元素,示例代码如下:


<h2> html <mark> Marked </mark> formtting </h2>

登录后复制

输出:

HTML 命令

2. Delete text

In HTML, we can delete some text using element so that the text which is enclosed between this element is deleted, and the sample code is as below:


<p> My favorite color is <del> Navy blue </del> Red </p>

登录后复制

Output:

HTML 命令

3. Define superscripted text

In HTML, we can define the text as superscripted using element in the HTML document so that text enclosed in element will be superscripted, and the sample code is as below:


<p> This is <sup> superscripted </sup> text </p>

登录后复制

Output:

HTML 命令

4. Define abbreviation

In HTML, we can define abbreviations by using the HTML element in the HTML document, which will give useful information to browsers, and the sample code is as below:


<p> The <abbr title="World Health Organization">WHO </abbr> was founded in 1948 </p>

登录后复制

Output:

HTML 命令

5. Mention Address

In HTML, we can mention the address in an HTML document using HTML element

, which defines contact information or address related to the article or document and displays in italics and the sample code as below:

<address>
Written by Srinivas <br>
dasu.com <br>
Pincode : 500084, Hyderabad <br>
India
</address>

登录后复制

Output:

HTML 命令

Advanced HTML Commands

The advanced commands are as follows:

1. Display a webpage inside a webpage

In HTML, we can display a webpage inside a webpage using HTML iframe, which is defined using the tag


<iframe src="demo.html" height="300" width="300"> </iframe>

登录后复制

2. Target different targets using iframe

In HTML, we can use the target frame as a link using the iframe tag in the HTML document, and the target attribute to the link must refer to the name attribute of the iframe and sample code is as below:


<iframe src="demo.html" name="iframe1"> </iframe>
<p> <a href="www.google.com" target="iframe1"> Google.co.in </a> </p>

登录后复制

Tips and Tricks to Use HTML Commands

  • Make your visitors change the text color or background by adding extra code.
  • Add metadata while writing an HTML document.
  • It’s good to hide some fields where we don’t want a user to edit them.
  • Always add a horizontal line to break long sections so the website will look good.

Conclusion

Finally, it’s all about different types of HTML commands of various levels are briefly discussed with examples. After reading this article, I hope you will have a good idea of how to use HTML commands.

以上是HTML 命令的详细内容。更多信息请关注PHP中文网其他相关文章!

来源:php
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!