I believe that many friends who are new to web pages are like me, and don’t understand how elements, tags, and attributes are defined in HTML, and what is the difference between elements and tags. In order to understand it thoroughly, I searched and consulted some information. Now I write down my conclusions and share them with netizens who have the same confusion as me: Many people may not have a clear idea of which is a tag and which is an element, including me before, I have always been confused. In fact, the concept between the two is still very clear: For example, <p> is a tag; <p>Content goes here</p> This is an element, which means that an element consists of a start tag and an end tag, and is used to contain certain content; There is one notable exception here, which is that <br/> itself is both a start tag and an end tag, but it contains no content, so it is just a tag. 1. Elements : An HTML web page is actually a text file composed of many different HTML elements, and any web browser can run HTML files directly. So it can be said that HTML elements are the basic objects that constitute HTML files, and HTML elements can be said to be just a general term. HTML elements are defined using HTML tags. 2. Tags : Tags are objects enclosed in angle brackets “<” and ">”, such as <head>, <body>, <table>, etc. Most tags appear in pairs, such as <table></talbe>, <form></form>. Of course, there are a few that do not appear in pairs, such as <br>, <hr>, etc. Tags are used to mark HTML elements. The text between the start and end tags is the content of the HTML element. 3. Attributes : HTML attributes provide various additional information for HTML elements. They always appear in the form of name-value pairs such as "attribute name = attribute value", and attributes are always defined in the start tag of HTML elements. Example : <html> <head> <title>Example title</title> </head> <body bgcolor="red"> <p>This is an example page</p> </body> </html> In this example, <p>This is an example page</p> is the HTML element, and “This is an example page” is the specific content of the element. <head><title><body> etc. are HTML tags, which constitute HTML elements. The bgcolor="red" in <body bgcolor="red"> is the attribute of the tag, which defines how the tag should be configured. In short, you don’t have to worry too much about the difference between elements and tags. In actual work, we just refer to them as tags. Attributes are easy to understand. They are parameters that add various additional information or configuration options to HTML tags. |
<<: This article will help you get started and understand the basic operations of Jquery
>>: Summary of three ways to implement ranking in MySQL without using order by
Introduction: Interface designer Joshua Porter pub...
Operating system: windowns10_x64 Python version: ...
Table of contents 1. let keyword 1.1 Basic Usage ...
This tutorial shares the installation and configu...
MySQL Workbench - Modeling and design tool 1. Mod...
Two days ago, I took advantage of the Double 11 s...
Table of contents 1. Content Overview 2. Concepts...
This article shares the specific code of the vue-...
1. Install less dependency: npm install less less...
Table of contents Preface What is data binding? T...
Preface Slow system calls refer to system calls t...
Table of contents Arithmetic operators Abnormal s...
Implement Nginx load balancing based on Docker ne...
How to view files in a docker image 1. If it is a...
It is essentially a common js object used to desc...