HTML | What is <marquee> and what can i do with it?

ぐ巨炮叔叔 提交于 2019-12-13 01:33:33

问题


I just found out that there is a html tag called <marquee>. I went to several websites including the w3schools and the selfHTML website but couldnt find anything about this tag. IntelliJ wich I'm using to write my websites, doesnot recognise this tag. It says: Unkown html tag marquee. This tag is how I tested compatible with all browsers(even in IE!).

So now I have the following Questions:

  • What atributes can I use for this tag?

  • Why isnt this tag on the html-turtorial sites?

  • If its not in the W3Schools -> who created this tag?

Just that you know what I'm all talking about:

<marquee>Test Marquee</marquee>
<p>Test Paragraph</p>

Thanks for answering


回答1:


<marquee> is an old HTML element that causes whatever content inside of it to scroll across the viewport from right to left by default.

It may still work in some browsers for backwards compatibility, but it is no longer officially supported in HTML and should be avoided. That's why you are not finding it on tutorial sites. And since it is no longer supported, there is no guarantee that even if it works in some browsers today, it will continue to work in new versions of those browsers tomorrow.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/marquee




回答2:


The HTML <marquee> element is used to insert a scrolling area of text.

marquee tag is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Highly recommended not to use them with HTML5. Try to avoid using it.

Instead of marquee, you could use alternatives like jquery with css3 or CSS marquee style should be used instead. etc..

See https://developer.mozilla.org/en/docs/Web/HTML/Element/marquee..




回答3:


The marquee tag was introduced by either Netscape or Microsoft, back then when there was a browser war between Netscape 4 and IE4. It could be part of HTML 3, but definitely not of the HTML 4 Standard.

Nevertheless, current browsers just support it, since the code is already builtin for backwards compatibility.




回答4:


The <marquee> tag is used to denote snippets of text or content that you want to scroll on a page.

Taken from MDN:

<marquee>This text will scroll from right to left</marquee>

<marquee direction="up">This text will scroll from bottom to top</marquee>

<marquee direction="down" width="250" height="200" behavior="alternate" style="border:solid">
  <marquee behavior="alternate">
    This text will bounce
  </marquee>
</marquee>

However, you don't really want to use this as there is no guarantee it is supported by all browsers.

It is also considered obsolete:
https://www.w3.org/TR/html5/obsolete.html#the-marquee-element-0

If you want this effect I recommend looking at this answer:
Very Simple, Very Smooth, JavaScript Marquee



来源:https://stackoverflow.com/questions/36454580/html-what-is-marquee-and-what-can-i-do-with-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!