Home Web Front-end HTML Tutorial Explanation of the basic elements of Html Element

Explanation of the basic elements of Html Element

Jul 19, 2017 pm 04:45 PM
element html Basic

I wrote this article after studying in the IT Cultivation Park for a period of time and reviewing it. Although it is just some basic knowledge content, I hope it can help everyone.

First of all, we need to understand what is the definition of html?

HTML DOM Node

In HTML DOM (Document Object Model), each part is a node:

The document itself is a document node

All HTML elements are element nodes

All HTML attributes are attribute nodes

The text within HTML elements is text nodes

Comments are comment nodes

Element object

In the HTML DOM, the Element object represents an HTML element.

Element objects can have child nodes of type element nodes, text nodes, and comment nodes.

NodeList object represents a list of nodes, such as a collection of child nodes of an HTML element.

Elements can also have attributes. Properties are attribute nodes.

[html: hypertext tag language, text: file in txt format, tag: use tags to to append semantics to the text]

If you already have an understanding of html through the above, let's start studying its three elements.

Block-level elements and inline elements and inline fast elements (inline-block)

Some popular science background: html layout: documentation Flow, float, position and display:flex layout.

Based on the document flow that first appeared, some elements are also given their original semantics.

Block: Block-level element occupies a line alone, and the width and height can be set ; if no width is given, block-level elements The default is the width of the browser, that is, 100% width;

Inline: Inline elements: Multiple tags can exist in one line , and the width and height attribute values ​​​​are not It takes effect, completely depends on the content to support the width and height !

Inline-block: Inline block element: The key points of combining inline and block levels, not only can set the width and height, but also Multiple tags exist in one line for display;

(div, p, ul, li) container: block-level element

The default attribute is to add < before and after ;br>Line break.

(Span,img,input,a) text: inline element
tag has no semantics, function: attributes can be set independently

gives some main elements to master. At the same time, I believe it is easier for the audience to understand and remember these contents. If you still haven't formed their appearance in your mind. You can refer to the word document to see if a paragraph of text is arranged line by line from left to right and top to bottom by default. Whether the table adds one row and two columns or one row and multiple columns, the default is to cover the entire A4 paper. At this point everyone should be able to remember them.

The concepts and representatives have been mentioned, but we must not only understand their semantics, but also use them in a down-to-earth manner.

Let’s talk about inline first. The text and img should be positioned to the right, centered and shifted, which is exactly the same as the 6 positions in the word editor. In web page settings, Text-align: center is frequently used.

I won’t explain them one by one. Here is the inner scripture, as follows

Text-align: It is set in in the parent box tag specifies that the inline elements ( text or img tag) in the box are centered.

Line-height: refers to the height of the line box (line height) of the text. Composed of (top and bottom spacing and text height)

The principle of vertical implementation: container height = line box height. The default text height is 16px. When the container height=line-height=200px is set, the top and bottom spacing will be automatically divided into 184px.

Margin: 0 auto: It is set in the box label to be centered. Generally, the box width also needs to be set.

vertical-align:middle: It is set in the two inline element tags , so that the two inline elements are between the two and the last inline element The preceding inline elements are vertically aligned with each other.

Tex-align and line-height are often used together to vertically center a line of text.

Vertical-align:middle is often used for vertical alignment of text and img.

Vertical-align This attribute, if you want to study it carefully, really needs to incorporate a lot of new content. In fact, we don’t need to understand his baseline, midline, and top line. We just need to know how to use them.

There is one more thing that must be said:

vertical-align is an inline-block dependent element. If it is not an inline-block element, it will be ignored. Some elements support it by default: Pictures, buttons, single check boxes, single-line/multi-line text boxes and other HTML controls

The above is the detailed content of Explanation of the basic elements of Html Element. 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