Introduction to XHTML common tags


For some time, I found that many people can’t use XHTML, not only ordinary beginners, but also some programmers don’t know how to write XHTML. Here, I can summarize some common application problems, which can also enable us to form a tacit understanding in communication and cooperation.
There are many tags in XHTML, but there are only a few that are often used. Just master these. Let’s list them one by one: div, P, span, UL, Li, DL, DT, DD, a, IMG, h, strong, em
Div is in my mind. I always think of it as a bottle or a box. I feel it’s very hard. This div has no feature meaning and can be used in many places, that is, it can hold different things. His correct way of writing is that < div > < / div > must be sealed. We all use it for layout and also for storing articles to form paragraphs. In fact, this practice is not very good, because there is a specific label for the segmentation of articles. That is the < p > < / P > tag to be discussed below, but use div to wrap all paragraphs as a whole. This is very practical.
P this is a label with specific semantics, which indicates paragraphs and is used to distinguish paragraphs. In most browsers, there is basically an up and down margin for P. However, there is no line indentation, because line indentation is only a way to represent a paragraph, but it is not necessarily or necessary. Therefore, when using the P tag, if necessary, you can set a line indent for P. I recommend not to use p outside the article, because P has a certain semantics, which may not be appropriate in other places. The correct way to write it is < p ></p>
Span is also a very commonly used tag. It can be said that this tag is very similar to div and has no specific meaning, but it is a cascading element, not a block level element. I have always regarded it as a bag. Unlike the box, it can have its own width and height. Its width and height can only be determined according to the content, so it is very like a bag. This tag is complementary to Div.
UL, Li this is a list. In the list, there are ol in addition to UL, but I think ol is a bit like chicken ribs. Because UL can have the same number sorting effect as ol through CSS definition. Therefore, I generally do not recommend the use of ol. It is OK to have UL. UL is block level, and its children Li are also block level labels. The correct way to write it is < UL > < li > < / Li > < / UL > the Li tag is wrapped by the UL tag. There can be countless Li tags in the UL tag, and the Li tag cannot be used independently. And the Li label must be sealed, which is not only a beautiful problem, but also good for later maintenance. Many programmers don’t like to seal this Li. UL list is mainly used to list one-dimensional and the same type of data. For example, some regulations on the number of columns used in the menu and the article, and so on. There is a special form in the list that is different from UL. That’s the DL below
DL, DT, DD this is a very special combination of three tags. DT refers to the content here. DL is their container. The correct way to write it is < DL > < DT > < / dt > < DD > < / DD > < / dl > there can be many groups of DT and DD in DL. When there are many groups, try to match one DT with one DD. if there are many contents in DD, you can add a p label in DD for use. DL list is a very good form of list, which can be used more.
A this means that the link is a specific attribute, and it is also the most magical tag in the web page. Because of it, countless web pages are connected together. The correct writing method is: < a href = “” title = “” > < / a > where href is the target address and title is the mouse hover prompt text, which is optional. But there must be more profit than nothing.
IMG this is a picture tag and a tag of specific attributes. The normal writing method is: < img SRC = “” ALT = “” title = “” / > SRC here is the target address, ALT and title are replacement text, ALT is ie specific, and title is common to other browsers. But remember the backslash at the back. It must be there.
H this is a series of labels, from H1 to H6, a total of six. Some say it’s too little, some say it’s just used, and some say it can’t be used so much. I think so anyway. The correct writing method is: < H > < / H > is mainly used to store the title, and some friends use it for other purposes. Personally, I think this label still makes him feel at ease, so let him do the function of the title. It’s best not to include anything between these six labels.
Strong this means to emphasize. It has semantics and its function is very simple. As for the sample work, it is up to you to choose whether to emphasize it in bold or color. The correct way to write it is < strong > < / strong >
EM is very similar to strong. It means to emphasize. The default value for general browsers is italic. The usage is the same as strong. The writing method is: < EM ></em>
There is no form here, because there is basically no change in the form, and there is nothing special to say.