Summarize the common application problems of XHTML code

Time:2022-1-6

For a period of 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. I’m here to summarize some common application problems, so that we can form a tacit understanding in communication and cooperation.
For a period of 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. I’m here to summarize some common application problems, so that we can 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 him as a bottle or a box. I think 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 represents 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 certain semantics, and it may not be appropriate to use it in other places. The correct writing is < p ></p>
Span is also a very common tag. It can be said that this tag is very similar to div and has no specific meaning, but it is a cascade 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 writing is < UL > < li > < / Li > < / UL > Li tags are wrapped by UL tags. There can be countless Li tags in UL tags, and Li tags cannot be used independently. Moreover, 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, etc. 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 here refers to the title and DD refers to the content. 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 tag in DD for use. DL list is a very good list form, 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 over prompt text, which is optional. But there must be more profit than nothing.
IMG this is a picture tag and a tag for a specific attribute. 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 way to write it 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, whether to emphasize it in bold or color is your choice. The correct way to write it is < strong > < / strong >
EM is very similar to strong. It means emphasis. The default value for general browsers is italic. The usage method 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 to say in particular.