Home > Web Front-end > HTML Tutorial > HTML basics

HTML basics

墨辰丷
Release: 2018-05-16 09:20:05
Original
3443 people have browsed it

This article mainly introduces the basics of getting started with HTML. Interested friends can refer to it. I hope it will be helpful to everyone.

Tags, tags, elements

Tags and elements usually describe the same thing, but strictly speaking, an HTML element contains tags and closing tags.

A standard HTML page

<!DOCTYPE html>  <!--声明了文档类型-->
<html>    <!--描述了文档类型-->
<head>    <!--可以插入<script>脚本,样式文件(css)以及各种meta信息
<meta http-equiv="content-type" content="text/html;charset="utf-8" />
<title>页面标题</title>
</head>
<body>    <!--可视化网页内容(文档的主体)</body>
Copy after login

Common tags

①HTML title: < /h>

The title is defined through the

~

tags, h is the abbreviation of "header". h1 is the main title and can only be used once, h2 is the subtitle, and h3~h6 decrease the font size in descending order.


##②HTML paragraph:

The paragraph is defined by the tag

, p is the abbreviation of "paragraph" and is often used to create a paragraph.

③HTML connection

The link is defined by the tag . The a tag is also called an archor (anchor) element, which can be used to link to an external address to implement the page jump function, or to link to the internal navigation function of the current page.

Href = "URL navigation" target = "_ Self": Jump on the current page (default) target = "_lank": New page jump

##hang anchor point: A token on a line in a document that links to a location in the document.

Define anchor point:                                                                                                                                         >Back to top                                              ​

If you only write it will return to the top of the page by default

④HTML image

HTML basics

图像通过单标签HTML basics来定义。

error

src指“source”。源属性的值是图像的URL地址。

alt属性用来为图像定义一串预备的可替换的文本。

title属性可以让鼠标悬停在图像上时显示title内容(通常是图像标题)。


⑤特殊字符与标签


标签可以进行换行操作


标签可以定义水平线 空格 < < > >

⑥HTML文本格式化

可以使用标签对输出的文本进行粗体或斜体转换。通常可以使用代替前者。然而,这些标签的含义不同:

定义粗体或斜体文本。

意味着这段文本是重要的,所以要突出显示。

缩小文本 放大文本

下标 上标

保留文本里所有的空格和换行操作
Copy after login

对于HTML,无法通过在HTML代码中添加额外的空格和空行,所有连续的空格(换行)会被合并为一个。

⑦HTML区块

HTML可以通过

将元素组合起来。大多数HTML元素被定义为块级元素或内联元素(行内元素)。

块级元素:独占一行,元素前后自动换行。例如: