Introducing markup and document structure in html
The purpose of marking content with HTML is to give the web page semantics. In other words, you need to give your web page content some meaning that the user agent can understand.
HTML specifies a set of tags to mark content differently. Each tag is a description of what it contains. The most commonly used HTML descriptions are titles, paragraphs, links and pictures. Currently, HTML has a total of 114 tags, but according to the 80/20 principle, using about 25 of them can meet 80% of markup needs.
The latest version of HTML, HTML5, stipulates a new batch of structured tags, which are used to group tags of related content to better standardize the overall structure of the web page. These new tags include
1. Closure of tags
For each content-containing element (such as title, paragraph, and picture), there are two different ways to give it depending on whether the content it contains is text. They are tagged, one with a closing tag and the other with an unclosing tag.
1.1 Use closing tags for text
Example:
Hello, CSS!
1.2 Use self-closing tags for quoted content
Example: <img src="images/dog.jpg" alt="This is my dog." >
Tips:
For self-closing tags, XHTML requirements must be written like this:
XML/HTML Code copies the content to the clipboard
<img src="images/dog.jpg" alt="This is my dog." />
In HTML5, you can omit the last closing slash and write:
XML/HTML CodeCopy content to the clipboard
<img src="images/dog.jpg" alt="This is my dog." >
2. Attribute
Tip: Screen readers used by visually impaired users will read the content of the alt attribute out loud, so be sure to give it The
alt attribute of the tag adds content that people can understand at a glance (or at a glance).
3. Titles and paragraphs
4. Composite elements
HTML not only specifies basic content tags such as titles, pictures, and paragraphs, but also specifies rules for creating lists,
Tables Tags for complex user interface components such as tables and forms. These are so-called composite elements, that is, they are composed of multiple
tags.
5. Nested tags
Simply put, it is to nest one tag inside another tag.
6.HTML5 Template
XML/HTML Code Copy content to the clipboard
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>An HTML Template</title> </head> <body> <!-- 这里是网页内容 --> </body> </html>
7. Block-level elements and inline elements
Document flow effect: HTML elements will They flow from the top of the page to the bottom in the order in which they appear in the markup.
The display attribute of almost all HTML elements is either block or inline. The most obvious exception is the table element, which has its own custom display value.
Block-level elements (such as headings and paragraphs) are stacked on top of each other and arranged down the page, each element occupying its own line. Inline elements (such as links and images) will be juxtaposed with each other, and will be folded to the next line only if there is not enough space to juxtapose.
No matter which HTML element you want to know about, the first question to ask should be: Is it a block-level element, or an inline element? Once you know this, you can anticipate how an element will be positioned in its initial state when writing markup, so that you can further think about how to reposition it using CSS in the future.
There are two things to know:
The block-level element box will expand to the same width as the parent element.
Inline element boxes will shrink-wrap their contents as tightly as possible.
7. Nested elements
The HTML tags are nested in the mark, and the boxes are nested on the screen.
8. DocumentObjectModel
The Document Object Model (DOM for short) observes the elements in the page and each element from the perspective of the browser attributes, resulting in a family tree of these elements. Through the DOM, the interrelationships between elements can be determined. By referencing a specific location in the DOM
in CSS, you can select the corresponding HTML element and modify its style attributes.
CSS The process of manipulating the DOM is to first select an element or a group of elements, and then modify the properties of these elements. After an element is modified through CSS, such as changing the width or inserting a pseudo-element in the markup, these changes will immediately occur in the DOM and be reflected on the page.
In short, it is to build the DOM through HTML tags, and then use CSS to modify the DOM when the page is first loaded and when the user interacts with the page.
The above is the detailed content of Introducing markup and document structure in html. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



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

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

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.

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

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

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

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

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