Why marquee is not compliant with web standards

Source: Internet
Author: User
Tags add integer tagname
Web|web Standard

Jeanjean20 mentioned marquee How to modify to meet the standard . I looked at a few friends of the thread feel very good, moderator Greengnn specified marquee is not compliant with the standard has been abandoned by the consortium. Have a friend big dozen uneven say feel to go to have no reason, originally quite good effect now become gone. Also have a friend said to go good, look at the annoying. Everyone has their own understanding of the angle, but how we understand it is one thing, but we have to figure out why, here I greengnn the conclusion of the changes and add some content, I hope you understand and can think.

The first thing to correct is thatmarquee was abandoned by the consortium . This is actually wrong, why, because marquee has never been used as a formal label by the consortium. The consortium has never made this label, and there is no "abandonment". It's like saying divorce before you get married. In fact, marquee, like many other labels, is privately made by companies such as Microsoft and Netscape, and the consortium has never recognized the label. This rich company is unreasonable this problem, but this is not profitable organization is stubborn!

Why has the marquee not been recognized by the consortium? To say this label in the eyes of the vast number of Web designers is also a screwdriver Ah! In the early years, we thought of the technical force as the capital of showing off. But now do not advocate use (here is a digression: Many people say that the "no use of the", this is wrong, the consortium does not have the right to limit your use or not to use. Why, then, we have to be clear about what this criterion is. Standards are not a technology, standards are just a specification and proposal. We are still using the tags in the original HTML4.0, the standard does not add any tags to our XHTML, but gives us what is recommended (example: P,div,ul,dl,span,em ...). ), which is advocated not to use (example: Font,b,u,i ... ) and advocates the specification of semantics and usage. Of course, the standard is not only XHTML but also CSS and Dom as well as scripting language. Many people think that CSS is the standard after the production, in fact, CSS is very early, the standard for CSS is the same, advocating not to use some browser manufacturers to develop some CSS, such as CSS filters.

Another important point in the standard is functional separation. Divided into three parts of structure, style, and behavior, these three parts include, structure (XHTML, XML), sample work (CSS), Behavior (DOM, ECMAScript). Here we go back to think about why the marquee is not recognized by the consortium, I think the big guys should understand. He is no longer a structural label than a label like font or B. They have styles and behavioral characteristics, and it's obviously superfluous to put them in the category of structure.

So, we hope that the effect of marquee can be preserved or implemented requires a lot of attention to JavaScript, scripting language will be able to make your page move. If you want to get your designated place to move, be sure to pay attention to the ID and class usage in the tag. If you do not know, you can look at my May 8 article .

In order to facilitate the use of this interesting effect, I deliberately asked whining to write a paragraph of JS, look at the following code:

JS code:

Function Getelementsbyclass (searchclass,tagname) {
 var classelements = New Array ();
 if (tagName = null)
  tagName = ' * ';
 var els = document.getElementsByTagName (tagName);
 var Elslen = els.length;
 var pattern = new RegExp ("(^|\s)" +searchclass+ "(\s|$)");
 for (i = 0, j = 0; i < Elslen; i++) {
  if (pattern.test (Els[i].classname)) {
   class ELEMENTS[J] = els[i];
   J + +;
 }
 }
 return classelements;
}
 
function Ccmarquee (className) {
 var a=getelementsbyclass (className);
 for (i = 0; i < a.length; i++) {
  a[i].innerhtml= "" + a[i].innerhtml+ "";
 }
}window.onload = function () {
 ccmarquee ("Ccmarquee");
} XHTML code:


Attached: label attributes detailed

Please read the following code first
Here Enter scrolling content

Now let's make a concrete analysis.
Direction represents the direction of scrolling, the value can be Left,right,up,down, the default is left behavior means scrolling, the value can be scroll (continuous scrolling) slide (sliding once) alternate (scrolling back and forth) Loop represents the number of loops, the value is a positive integer, the default is an infinite loop scrollamount the motion speed, the value is a positive integer, the default is 6 scrolldelay to indicate the pause time, the value is a positive integer, the default is 0, the unit appears to be a millisecond align the vertical alignment of elements, The value can be top,middle,bottom, the default is middle bgcolor indicates the background color of the motion area, the value is 16 RGB color, the default is white height, width represents the height and width of the motion area, the value is a positive integer (in pixels) or a percentage, The default width=100% heights is the height of the elements within the label hspace, vspace represents the horizontal and vertical distances from the element to the area boundary, and the value is a positive integer, in pixels. Onmouseover=this.stop () Onmouseout=this.start () indicates that scrolling stops when the mouse is over the area, and continues scrolling as the mouse moves away.



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.