Table of Contents
标题元素,占据一行
Home Web Front-end HTML Tutorial What types of html tag elements are there? Introduction to common tag elements in html

What types of html tag elements are there? Introduction to common tag elements in html

Oct 23, 2018 pm 02:33 PM
html block element inline elements

The content of this article is to introduce the types of html tag elements, so that everyone can understand what are the commonly used tag elements in html? It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

First of all, let’s understand what types of html tag elements can be divided into?

Tag elements in HTML are generally divided into three different types: block elements, inline elements, and inline block elements.

Let’s introduce the characteristics and uses of these three types of elements in detail, and let everyone know what are the commonly used block elements and inline elements?

Block elements

Features:

1. Each block occupies one row The elements will start again from a new line and be arranged from top to bottom

2. You can directly control the width, height and related css properties of the box model (element's height, width, line height and top and bottom margins All can be set)

3. When the width is not set, the width of the block-level element is the width of the content of its parent element

4. When the height is not set, the width of the block-level element is the width of the content of the parent element. The height of a high-level element is the height of its own content. Because of its own characteristics, we usually use block elements to build large layouts (large structures).

Commonly used block elements:

1. Ordinary elements

div (commonly used block containers and the main tags of CSS layout), p (Paragraph), hr (horizontal separator), table (table), form (interactive form)

2, title elements:

h1 (headline), h2 (subtitle), h3 (Third-level heading), h4 (fourth-level heading), h5 (fifth-level heading), h6 (sixth-level heading)

3, list element

menu (menu list), ol ( Ordered list), ul (unordered list), li (list item), dl (define list), dt (define term), dd (define description)

Let’s take a look at these blocks through simple code Shape element

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>块状元素</title>
		<style>
			div{
				background-color: palegoldenrod;
			}
			p{
				background-color:paleturquoise ;
			}
			h4{
				background-color:papayawhip;
			}
			ul{
				background-color: peru;
			}
		</style>
	</head>
	<body>
		<div>div标签元素,占据一行</div>
		<p>p标签元素,占据一行</p>
		<h4 id="标题元素-占据一行">标题元素,占据一行</h4>
		<ul>
			<li>ul1 li 标签 元素</li>
			<li>ul1 li 标签 元素</li>
		</ul>
		<ul>
			<li>ul2 li 标签 元素</li>
			<li>ul2 li 标签 元素</li>
		</ul>
	</body>
</html>
Copy after login

Rendering:


What types of html tag elements are there? Introduction to common tag elements in html

##Inline element

Features:

1. Displayed in one line with other inline elements from left to right

2. Width, height and related css attributes of the box model cannot be directly controlled. However, it is possible to directly set the left and right values ​​​​of the inner and outer margins

3. The width and height of inline elements are determined by the size of their own content (text, pictures, etc.)

4. Inline elements It can only accommodate text or other inline elements (please note here, do not nest block-level elements in inline elements)

Because of its own characteristics, we usually use inline elements to carry text , Construction of small icons (small structures).

Commonly used inline elements:

1. Common element tags

span (commonly used inline containers, defining in-text blocks), a ( Anchor point, link), img (introducing an image), br (forced line break), sub (subscript), sup (superscript)

2. Text modification tag

b (add bold), strong (bold emphasis), i (italic), em (italic emphasis), big (large font text), small (small font text), s (underline (not recommended)), strike ( (underline), del (text that has been deleted in the document), u (underline)

3. Label elements used in the form

textarea (multi-line text input box), input (Input box), select (drop-down list), label input (element definition label (mark))

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>行内元素</title>
		<style>
			span{
				background-color: palegoldenrod;
			}
			p{
				background-color:paleturquoise ;
			}
		</style>
	</head>
	<body>
		<span>span标签元素1</span>
		<span>span标签元素2</span>
		<img  src="/static/imghw/default1.png"  data-src="1.png"  class="lazy"      style="max-width:90%" / alt="What types of html tag elements are there? Introduction to common tag elements in html" >
		<img  src="/static/imghw/default1.png"  data-src="1.png"  class="lazy"      style="max-width:90%" / alt="What types of html tag elements are there? Introduction to common tag elements in html" >
		<p>换一行看看文字效果,我是一段测试代码,<b>被b标签加粗</b>。我是一段测试代码,<i>被i标签变成斜体</i>。</p>
</html>
Copy after login
Rendering:

What types of html tag elements are there? Introduction to common tag elements in html

Inline block elements

Features:

1. They are on the same line as other elements and will not wrap automatically. The default arrangement is from left to right;

2. The height, width, line height, top and bottom margins of the element can be set.

Inline block elements combine the characteristics of inline elements and block elements, but each has its own trade-offs. Therefore, inline block elements are used more often due to their characteristics in daily use, and are useful in many aspects.

Summary: The above are the three types of html tag elements introduced in this article, namely: block elements, inline elements, inline block elements; and an introduction to commonly used block elements and inline elements. Each type of label has its own characteristics. You can try it yourself to see how different labels are used, deepen your understanding, and use different labels in different situations as needed. I hope it will be helpful to everyone's learning. For more related tutorials, please visit: HTML video tutorial, Html5 video tutorial, bootstrap video tutorial!

The above is the detailed content of What types of html tag elements are there? Introduction to common tag elements in html. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Table Border in HTML Table Border in HTML Sep 04, 2024 pm 04:49 PM

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

Nested Table in HTML Nested Table in HTML Sep 04, 2024 pm 04:49 PM

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

HTML margin-left HTML margin-left Sep 04, 2024 pm 04:48 PM

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

HTML Table Layout HTML Table Layout Sep 04, 2024 pm 04:54 PM

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

HTML Input Placeholder HTML Input Placeholder Sep 04, 2024 pm 04:54 PM

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

HTML Ordered List HTML Ordered List Sep 04, 2024 pm 04:43 PM

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Moving Text in HTML Moving Text in HTML Sep 04, 2024 pm 04:45 PM

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

HTML onclick Button HTML onclick Button Sep 04, 2024 pm 04:49 PM

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

See all articles