Home  >  Article  >  Web Front-end  >  Introduction to the usage techniques of commonly used XHTML tags_HTML/Xhtml_Web page production

Introduction to the usage techniques of commonly used XHTML tags_HTML/Xhtml_Web page production

WBOY
WBOYOriginal
2016-05-16 16:45:241166browse

There are many tags in XHTML, but there are only a few that are often used, and you only need to master these few. Let’s list them one by one below: div, p, span, ul, li, dl, dt, dd, a, img, h, strong, em
For some time, I have found that many people do not know how to use XHTML. Not only ordinary beginners, but also some programmers do not know how to write this XHTML. Here I will make a list of some common application problems. In summary, it can also be considered as a way for everyone to form a tacit understanding in communication and cooperation.
div In my mind, I always think of it as a bottle or a box. I feel it is quite hard. This div has no specific meaning and can be used in many places, which means it can hold different things. The correct way to write it is
must be sealed. Everyone uses it for layout purposes, and it is also used to store articles to form paragraphs. In fact, this method is not very good, because there is naturally a specific tag to use as a paragraph for an article. That is the

tag that I will talk about below, but use DIV to wrap all the paragraphs as a whole. This is very practical.
p This is a tag with specific semantics, indicating a paragraph, and is used to distinguish paragraphs. In most browsers, there is basically a top and bottom margin for P. But there is no indentation at the beginning of the line, because the indentation at the beginning of the line is just a way to express the paragraph but it is not certain or necessary. Therefore, when using the P tag, if necessary, you can set the beginning of the line indentation for P. I recommend not using P outside the article, because P has certain semantics, and it may not be appropriate if used in other places. The correct way to write it is


span This is also a very commonly used tag. This tag can be said to be very similar to a div. It has no specific meaning, except that it is a cascading element, not a block-level element. I have always regarded it as a bag. It does not have its own width and height like a box. Its width and height can only depend on the amount of content, so it is very much like a bag. This tag is exactly complementary to the div.
ul,li This is a list. In the list, in addition to UL, there are also OL, but I think OL is a bit useless. Because UL defined through CSS can also have the numerical sorting effect of OL. So generally I don’t recommend using OL, as long as you have UL. UL is block-level, and its child li is also a block-level tag. The correct way to write it is
  • 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. This is not only a cosmetic issue, but also very beneficial for later maintenance. Many programmers don't like to seal this LI. The purpose of the UL list is mainly to list one-dimensional data of the same type. Specific examples include those used on the menu, some regulations listed in the article, etc. There is a special form in the list that is different from UL. That is 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 the container that packages them. The correct way to write it is
    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 DD There is a lot of content in it, you can add the P tag to DD for use. DL list is a very good list format and can be used more.
    a This represents a link, which has a specific attribute and is also the most magical tag on the web page. Because it connects countless web pages together. The correct way to write it is: The href represents the target address, and TITLE is the mouse-over prompt text, which is optional. But there must be more benefits than nothing.
    img This is an image tag, and it is also a tag with specific attributes. The normal writing method is: where src is the target address, ALT and TITLE are replacement text, ALT is specific to IE, and TITLE is common to other browsers. But remember that there must be a backslash at the end.
    H This is a series of tags, from H1 to H6, six in total. Some people say there are too few, some people say they are just enough, and some people say they cannot use so many. Anyway, I think it’s pretty much the same. The correct way to write it is: is mainly used to store titles. Some friends also use it for other purposes. Personally, I think this tag should make it more peaceful and let it serve as the title. It is best not to have any mutual inclusion between these six tags.
    strong This means emphasis, which has semantic meaning and its function is very simple. As for the sample work, whether to bold and emphasize or use color to express emphasis is your choice. The correct way to write it is
    em is very similar to strong and means emphasis. The default value of general browsers is italic. Use the same method as strong. The writing is:
    I’m not talking about the form here, because the form basically hasn’t changed much and there’s nothing special to say.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn