search
HomeWeb Front-endHTML TutorialHow to set image scrolling in html marquee tag? Image scrolling code example for marquee tag

This article mainly introduces the attributes of html marquee tags and examples of image scrolling usage of marquee tags. You can experiment more, so that the effect will be better. Let’s take a look at this article together

To set up image scrolling, we first understand the attributes of several html marquee tags:

  • innerHTML: Set or get the HTML located within the start and end tags of the object

  • scrollHeight: Get the scroll height of the object.

  • scrollLeft: Sets or gets the distance between the left edge of the object and the leftmost end of the currently visible content in the window

  • scrollTop: Sets or Get the distance between the top of the object and the top of the visible content in the window

  • scrollWidth: Get the scroll width of the object

  • offsetHeight: Get the height of the object relative to the layout or the parent coordinate specified by the parent coordinate offsetParent property

  • offsetLeft: Get the calculated left position of the object relative to the layout or the parent coordinate specified by the offsetParent property

  • offsetTop: Gets the calculated top position of the object relative to the layout or the parent coordinate specified by the offsetTop property

  • offsetWidth: Gets the object relative to the layout or The width of the parent coordinate specified by the parent coordinate offsetParent attribute

After you can figure this out, let’s take a look at a scrolling example:

<marquee align="left" behavior="scroll" bgcolor="#FF0000" direction="up" height="300" width="200" hspace="50" vspace="20" loop="-1" scrollamount="10" scrolldelay="100" onMouseOut="this.start()" onMouseOver="this.stop()">
 需要滚动的文字
 需要滚动的文字
 也可以程序代码
<img  src="/static/imghwm/default1.png"  data-src="https://img.php.cn/upload/course/000/126/153/5aa23f0ded921649.jpg"  class="lazy"   alt="How to set image scrolling in html marquee tag? Image scrolling code example for marquee tag" >
 </marquee >

I have inserted a picture above, the effect is dynamic, the screenshot is not very good, but we have to take a look, as shown in the picture:

How to set image scrolling in html marquee tag? Image scrolling code example for marquee tag

This is seamless scrolling of. We need to understand the properties inside before we can understand the principle. In fact, it is not difficult.

html Marquee tag image scrolling instructions:

1.The content in the middle can be Text, pictures, or text or pictures generated by the program

2.onMouseOut="this.start()": Used to set the mouse to continue scrolling when it moves out of the area

onMouseOver= "this.stop()": used to set the mouse to stop scrolling when the mouse moves into this area

html The image scrolling code for the marquee tag is as follows:

<marquee align="absbottom">align="absbottom":绝对底部对齐(与g、p等字母的最下端对齐)。 </marquee>
<marquee align="absmiddle">align="absmiddle": 绝对中央对齐。 </marquee>
<marquee align="baseline">align="baseline": 底线对齐。 </marquee>
<marquee align="bottom">align="bottom": 底部对齐(默认)。 </marquee>
<marquee align="left">align="left": 左对齐。 </marquee>
<marquee align="middle">align="middle": 中间对齐。 </marquee>
<marquee align="right">align="right": 右对齐。 </marquee>
<marquee align="texttop">align="texttop": 顶线对齐。 </marquee>
<marquee align="top">align="top": 顶部对齐。 </marquee>
  • behavior: Set the scrolling method

  • alternate: Indicates scrolling back and forth between the two ends.

  • scroll: It means scrolling from one end to the other end, and it will repeat.

  • slide: Indicates scrolling from one end to the other without repetition.

html The image scrolling code of the marquee tag is as follows:

<marquee behavior="alternate">alternate:表示在两端之间来回滚动。 </marquee>
<marquee behavior="scroll">scroll:表示由一端滚动到另一端,会重复。</marquee>
<marquee behavior="slide">slide:  表示由一端滚动到另一端,不会重复。</marquee>

bgcolor: Set the background color of the active subtitles. The background color can be RGB, 16 Set the format of the hexadecimal value or the color name.

html The benefits of the marquee tag:

The automatic scrolling effect of the page can be achieved by javascript, but today I accidentally discovered an html tag - < ;/marquee>A variety of scrolling effects can be achieved without js control.

You can use marquee tags not only to move text, but also to move pictures, tables, etc.

[Editor’s recommendation]

How to set the font color in html? Introduction to the method of setting font color in css

#html How to set the color of a tag? Summary of color settings for hyperlinks (css style)

The above is the detailed content of How to set image scrolling in html marquee tag? Image scrolling code example for marquee tag. For more information, please follow other related articles on the PHP Chinese website!

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
The Future of HTML, CSS, and JavaScript: Web Development TrendsThe Future of HTML, CSS, and JavaScript: Web Development TrendsApr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft