search
HomeWeb Front-endHTML TutorialExplanation of the basic elements of Html Element

Explanation of the basic elements of Html Element

Jul 19, 2017 pm 04:45 PM
elementhtmlBasic

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
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
What are boolean attributes in HTML? Give some examples.What are boolean attributes in HTML? Give some examples.Apr 25, 2025 am 12:01 AM

Boolean attributes are special attributes in HTML that are activated without a value. 1. The Boolean attribute controls the behavior of the element by whether it exists or not, such as disabled disable the input box. 2.Their working principle is to change element behavior according to the existence of attributes when the browser parses. 3. The basic usage is to directly add attributes, and the advanced usage can be dynamically controlled through JavaScript. 4. Common mistakes are mistakenly thinking that values ​​need to be set, and the correct writing method should be concise. 5. The best practice is to keep the code concise and use Boolean properties reasonably to optimize web page performance and user experience.

How can you validate your HTML code?How can you validate your HTML code?Apr 24, 2025 am 12:04 AM

HTML code can be cleaner with online validators, integrated tools and automated processes. 1) Use W3CMarkupValidationService to verify HTML code online. 2) Install and configure HTMLHint extension in VisualStudioCode for real-time verification. 3) Use HTMLTidy to automatically verify and clean HTML files in the construction process.

HTML vs. CSS and JavaScript: Comparing Web TechnologiesHTML vs. CSS and JavaScript: Comparing Web TechnologiesApr 23, 2025 am 12:05 AM

HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

HTML as a Markup Language: Its Function and PurposeHTML as a Markup Language: Its Function and PurposeApr 22, 2025 am 12:02 AM

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The Future of HTML, CSS, and JavaScript: Web Development TrendsThe Future of HTML, CSS, and JavaScript: Web Development TrendsApr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

See all articles

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

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function