In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
Today, I would like to share with you how to define and use div tags in HTML. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.
Definition and usage
You can define partitions or sections in a document (division/section).
Tags can divide a document into separate, different parts. It can be used as a strict organizational tool and is not associated with it in any format.
If you use id or class to mark, then the tag will become more effective.
Usage
Is a block-level element. This means that its content automatically starts a new line. In fact, line wrapping is inherent in the format. Additional styles can be applied through class or id.
You don't have to add classes or id to each, although there are some benefits to doing so.
You can apply class or id attributes to the same element, but it is more common to apply only one of them. The main difference between the two is that class is used for groups of elements (similar elements, or can be understood as a class of elements), while id is used to identify individual elements.
Example
A section of the document appears in green:
Thisisaheader
Thisisaparagraph.
Browser support
All major browsers support tags.
The difference between HTML and XHTML
In HTML4.01, the "align" attribute of the div element is not approved.
The "align" attribute of the div element is not supported in XHTML1.0StrictDTD.
Tips and comments:
Comment: is a block-level element, that is, browsers usually place a newline character before and after the div element.
Tip: use elements to combine block-level elements so that they can be formatted using styles.
Case analysis
NEWSWEBSITE
Sometext.sometext.sometext...
... Newsheadline1
Sometext.sometext.sometext...
... Newsheadline2
Sometext.sometext.sometext...
......
Example explanation
As you can see, the above HTML simulates the structure of a news site. Each of these div combines the title and summary of each piece of news, that is, div adds additional structure to the document. At the same time, because these div belong to the same category of elements, you can use class= "news" to identify these div, which not only adds the appropriate semantics to the div, but also facilitates the further use of styles to format div, killing two birds with one stone.
These are all the contents of the article "how to define and use div tags in HTML". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.