css variable font style

How we can customize specific characters between a word using CSS? Solution: CSS Variable Font Style With Split Character, Variable Text Animation.

Maybe you have heard about variable fonts, its different from normal static fonts. We can more customize and give special styles to each character or words. There is a JavaScript library to create variables to any fonts family, which is splitting.js (get). Basically, Splitting JS create elements and add CSS variables for animating text, grid, etc.

Today you will learn to create Variable Text Animation. In this program, I have selected some special characters between a word and give different color and styles. You do more like you can give transition and animation to selected char or words, font size, etc. I think this program will be very useful for you, and also you will understand the concept easily.

So, Today I am sharing CSS Variable Font Style With Split Character. Basically, there is a heading “webdev” and split its character using the JS library. And selected some special characters and give different style, height, width, animation, etc using CSS variable commands.

If you are thinking now how the variable text animation actually is, then see the preview given below.

Preview Of Variable Text Animation

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

Live Demo

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

You May Also Like:

CSS Variable Font Style With Split Character Source Code

Before sharing source code, let’s talk about it. As you know I have used splitting.js to creating this program. So, first I have created a heading using HTML <h1> tag. In the heading, I wrote WEBDEV and selected E, D, and V as a special character and stored using Data-* element.

Now there I have used some special CSS variable commands, for styling char separately. There is a command for manage font’s style font-variation-settings . Using this you can width and height of var font, But there is different command for width and height. For width, this is wdth and for height wght.

There left all other things you will understand after getting the codes, I can’t explain all in writing. For creating this you have to create only 2 files, one for HTML and one for CSS. Follow the steps to creating this without any error.

index.html

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

style.css

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

That’s It. Now you have successfully created CSS Variable Font Style With Split Character, Variable Text Animation. If you have any doubt or question comment down below.

Thanks For Visiting, Keep Visiting.

2 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here