css moving text mask

How we can create a moving text background using HTML CSS? Solution: See this CSS Moving Text Mask With JavaScript, Text Mask Background.

Previously I have shared many types of text related programs, but this is about text masks. Basically, masking means to mask a specific area and cut out the area and modify the visuality. And this program is about cutting text shape and showing a moving background image, the image will move according to the mouse movement.

Today you will learn to create Text Mask Background cutout. Basically, there is a text which is this web site’s name and a background image with text size cutout shape. When you will move the mouse pointer then the background image will also move opposite of mouse direction. And the program will be good practice for you of HTML CSS JS.

So, Today I am sharing CSS Moving Text Mask With JavaScript. There I have used jQuery for easy working and save times, and as we know jQuery is a JavaScript library that’s why I am putting this in the JS category. I think this program will useful for you, and you can use this on your website to add a little bit of style.

If you are thinking now how this moving mask actually is, then see the preview given below.

Preview Of Masking Background Movement

See this video preview to getting an idea of how this text mask looks like.

Live Demo

Now you can see this visually, you also can see this it live by pressing the button given above. If you like this, then get the source code of its.

You May Also Like:

CSS Moving Text Mask With JavaScript Source Code

Before sharing source code, let’s talk about it. First, I have just put a text using HTML div inside a main div. And in the HTML file, I have linked all external files like CSS, JS and jQuery‘s CDN link. This is a very short program that’s why HTML has fewer codes and all the styles and functions are handling by CSS & jQuery.

Now using CSS I have placed the text in the center, as you can see in the preview. There I have placed a background image for the text and set CSS values to background-clip: text; (info). And there also I have used some basic CSS stuff like letter spacing, transform, etc. And for the responsive design, I have reduced the font size for the small screen using @media query.

JQuery handling here the mouse movement function. There I have used JS $(document).mousemove command for declaring the mouse move actions. Left all other things you will understand after getting the codes, I can’t explain all in writing. For creating this program you have to create 3 files for that. First for HTML, second for CSS, and the third for JavaScript. Follow the steps to creating this without any error.

index.html

Create an HTML file named ‘index.html‘ and put these codes given below.

style.css

Now create a CSS file named ‘style.css‘ and put these codes given here.

function.js

The final step, create a JavaScript file named ‘function.js‘ and put the codes.

That’s It. Now you have successfully created CSS Moving Text Mask With JavaScript, Text Mask Background. If you have any doubt or question comment down below.

Thanks For Visiting, Keep Visiting.

LEAVE A REPLY

Please enter your comment!
Please enter your name here