For some time, found that there are many people XHTML will not use, not only ordinary beginners, some programmers are not very clear how to write this XHTML, I here it is a number of common application problems to do a summary, but also can make everyone in communication, cooperation can form a tacit understanding.
XHTML has a lot of tags, but often use that is a few, also as long as the master of these several can be. Here we list: Div,p,span,ul,li,dl,dt,dd,a,img,h,strong,em
Div In my mind I always think of him as a bottle or a box, I feel it is very hard. This div has no feature meaning, it can be used in a lot of places, that is to say, he can put different things. His correct wording is that <div></div> must have a seal. Everyone used to do the layout, but also to form a paragraph for storing articles, in fact, this practice is not very good, because as a section of the article nature has a specific label to use. That's the <p></p> tag below, but use div to wrap all the paragraphs in a whole. This is very practical.
P This is a label with a specific semantic meaning, which is used to differentiate paragraphs. In most browsers, p basically has a top and bottom margin. But there is no indent at the beginning of the line, because the line indent is just a way of representing the paragraph but not necessarily. So when using the P tag, if you need to be able to set the line indent for P, I recommend that you do not use p outside of the article, because P has a certain semantics, if used in other places is not suitable. The correct wording is <p></p>
span This is also a very common label, which can be said to be similar to the DIV, there is no specific meaning, but he is a cascading element, not block-level elements. I always think of it as a bag, he does not like the box can have his own width, his height can only be with the content of how much, so it looks like a bag. This tag is just as complementary as a div.
Ul,li This is a list, in the list, in addition to the UL also ol, but I think ol a bit like a chicken ribs. Because the UL through the definition of CSS can have ol number sorting effect. Therefore, I do not recommend the use of OL, UL can be. The UL is block level, his son Li is also block level label. The correct writing is <ul><li></li></ul> Li tag is covered by the UL tag, in the UL tag can have countless Li tags, li tags can not be used independently. And Li tag must be sealed, this is not only a beautiful problem, for the maintenance of the latter is also very good. Many programmers don't like to seal this li. The use of the UL list is mainly to enumerate one dimension, the same type of data. For example, use the menu, the number of columns in the article of some regulations, and so on. In the list there is a special form and UL is not the same. That's the DL below.
Dl,dt,dd This is a very special combination of three tags. The DT here refers to the title, and DD refers to the content. DL is the package of their containers. The correct writing is <dl><dt></dt><dd></dd></dl> there can be many groups of dt,dd in a DL, and when there are many groups, try to be a dt with a DD, If there is a lot of content in DD, it can be used with the P tag in DD. The DL list is a very good list form that you can use more.
A This means that the link is a specific attribute and the most magical label in the Web page. Because it makes countless pages are connected together. The correct writing is: <a href= "" title= "" "></a> in which the HREF is the target address, title is the mouse hover hint text, which is optional. But there must be more than no profit.
img This is a picture label, but also a label for a particular attribute. The normal writing is: Here src is the target address, Alt and title is the replacement text, Alt is IE specific, title is common to other browsers. But remember the back of the backslash that is sure to have.
H This is a series of labels, from H1 to H6, a total of six, some people say too little, some people say just use, some people say not so much. Anyway, I think it's pretty much. The correct writing is:
strong This meaning is the emphasis, this is semantically, the function is also very simple. As for the sample work, is the bold emphasis, or use color to show emphasis, it is their own choice. The correct wording is <strong></strong>
em This is very similar to strong, is to emphasize. The default value for general browsers is italic. Use the same way as strong. The writing is:<em></em>
There's nothing to say about the form, because the form basically doesn't change and there's nothing special to say.