When creating web pages, pay attention to the problem of applying HTML tags _ HTML/Xhtml _ web page creation

Source: Internet
Author: User
HTML has tried to remove representations and develop towards content, leading to the following basic principle: separating content meaning (HTML) from representations (CSS ). This will cause weight loss on the webpage, because a set of presentation commands (in the form of external CSS documents) can be applied to multiple pages. This also makes the website easier to manage because global changes can be obtained from modifying a separate file. Some bad HTML has tried to remove the performance and orientation of the content, leading to the following basic principle: Performance(CSS) separated Meaning(HTML ). This will cause weight loss on the webpage, because a set of presentation commands (in the form of external CSS documents) can be applied to multiple pages. This also makes the website easier to manage because global changes can be obtained from modifying a separate file.
Some poor labels are basically performance labels (such small), They can be replaced by more meaningful and simpler CSS rules. Others are not only used for performance, but also not necessary to be huge (for example fontTags) or the type that is harmful to availability (for example blink). Tag
The following are some of the tags you may often encounter that have better options: bIt can be used to generate bold elements. Use strong(Meaning strong emphasis) instead of more meaningful, or use CSS to do this, increase font-weight: boldTo indicate the bold elements. iIt can be used to generate italic elements. Use em(Emphasize), which is more meaningful. You can also use CSS to show italics: font-style: italic bigA larger font can be generated. Use the title (for example h1, h2When the text is originally a title) instead, it adds meaning, or simply uses it in CSS font-sizeProperty to obtain more control. smallSmall fonts can be generated. CSS ( font-size. hrIt can be used to display a horizontal line. Used in CSS hrThe design is rare. border-top, border-bottomAttribute or plain image will do better.
Although the above tags are compatible with the latest HTML standards, they do not have any meaning for the content. They cocould be more useful but they aren't Special harmful, and might easily be mistaken for innocent butter-wouldn't-melt-in-their-mouth nuggets of pure goodness when standing next to the following filthy tags. uUnderlines can be generated for elements. It reminds you that there are still many connections in the underlined text. That's why the label has been dead for a long time-you don't have to underline non-connection text. centerElements that can be centered inside the element. CSS attributes text-alignNot just centerAnd left, rightAnd justify. menuUsed to create a menu list. It does not ulPerfect because Unordered Lists are more common, ulHigh ground stands on the body of menu. layerAnd pElements are similar to each other, and they are all placed at the top of the CSS. This can only work in earlier versions of Netscape, so it is no longer useful. blinkOr marquee. Say NO! They should be expected as they mean, but have very limited support, and only produce very, very disgusting jokes. fontCan be used to define the font name, size, and color of an element. In the world of tags, the title of King of notorious tags is taken for granted. The old websites (and even new ones) are filled with the whole page like the ant of the plague in the world. Most fontThe surge in tags comes from the creation of web pages. fontLabels include colors and dimensions used in each element. fontTags are abused to appear in every duplicate element (for example, each time you use pCSS, you can use a short code to apply duplicate elements, or even control the entire website. The CSS method can not only increase the number of pages fontLabel parasitic SlimAnd it is easier to maintain because all you need to do is change One rowInstead of modifying each fontLabel. This also increases the possibility of maintaining a website consistent with the design style. fontThe use of tags and inappropriate tables is the main reason why the web pages do not need to be bloated. Attribute
Maybe you think you are using good labels, but there are still some troublesome parasitic properties lurking, they will come out at any time. nameUsed to specify a name for an element. inputThe form element is completely accepted, but elsewhere, nameThe job has been idReplace attributes. textAnd bgcolorYou can bodyThe start label defines the basic text color and background color of the page. CSS colorAnd background-colorAttribute applied bodyYou can also select a token. backgroundYou can specify a background image in the body tag. CSS performs better, and uses attributes such as background-image to process background images. link, alink, vlinkIn bodyTags are used to specify connections (unaccessed, activated, and accessed ). CSS baby ── :link, :activeAnd :visitedWill do the work. alignIt can be used to align the content of an element (for example

Stuff

), But, like centerTag, CSS text-alignAttribute is the new boss. targetYou can open a connection in different ways. The most common is to open a new window (for example Help me). It looks good, but you should not do this to your website. What you don't expect (such as a new window) appears, and the most common browser tool is the browser's back button. If you open a new window, this will be unavailable. It is neither feasible nor easy to use. Note:
Preserve the performance attribute of the tag. widthAnd height, Table cellpaddingAnd cellspacing, Because these elements often use different values. This is not a perfect solution, but if your webpage has a large number of images and tables, you have no other wise choice, so you have to use them.
The most incomprehensible performance attribute is textareaTag, which has only colsAnd rowsTwo Valid attributes are required in the latest HTML version. Good labels and poor use
To enter your bedroom, you can bend over through a dog hole, but wait, there's a door with a hand ready for humans! Wow, look -- it's just right for one entry.
Use HTML tags (good tags), whether Believe It Or Not (believe it !), There is a good reason: You have a good premise to use them, and you will have a better result.
The web page itself is easier to use than the syntax and semantics of HTML tags. ulTag or has h1Or h2Highlight them.
In the HTML Tag world, tables are the most abused. Tables are often used for layout, but tables should only be used to display table-type data, just like their design intent. The layout method without tables is not a kind of zen in the pursuit of enlightenment. It can not only significantly reduce the size of webpages, but also make it easier to maintain and redesign. Note:
Sometimes Hou designers will use the labels and attributes mentioned here (especially for table layout) Transition typeDesign-it can work on older browsers (especially Netscape4) or modern browsers. The table does have stronger performance control on the incompetent CSS Netscape4. Unfortunately, there are few and fewer users, and more users are showing the disadvantages of table layout. The aforementioned table-free design can prevent these shortcomings. Although a small number of users may experience significant performance changes AllBrowsing maintains full functionality. Framework
Goldilocks thinks drinking a cup of porridge is a good note, but three huge meat mammals suddenly appear, throwing her out of the window. The frame is a cup with porridge. They seem good, but they are now endangered and will soon disappear.
Most websites do not use a framework, but users generally take a document as a page.
In some cases, if you want to prevent users from adding specific webpages to bookmarks, or if you want users to recommend specific webpages through Email or instant chat software, or you want to make the entire website very complex, so that screen reader users can frequently operate between frames, or you want to confuse the search engine. That's enough. You can use the framework!
In short, the framework will only Increase complexityAnd Availability loss. Note:
As long as you follow the following rules, you will not have a future in making mistakes:
1)A tag or attribute only has a few PerformanceDo not use it. That's about CSS. And CSS is better.
2)Use tags in Name suggestion. Table labels are used on table data. The title label is used on the title. And so on.
3)For specific content Appropriate. List list, The title uses hx (x = 1-7) and so on. Standard points for further reading of the HTML advanced guide: getting rid of bad habits and turning to standards-compatible with XHMTL
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.