Valuable information without educational certificate
Education
Complete software development classes
Section under construction!
The most popular
Free WebApps
That solve everyday problems.
Wame
1. Start WhatsApp conversations with strangers, without adding them as contacts on your phone. 2. Create a QR that directs your business's WhatsApp so that your clients can write to you without having to add you as a contact
Create text with animated borders only with SVG and CSS
With the SVG element it is possible to build animated texts, assigning them the same attributes of any scalable vector graphic (SVG); to understand how to do it, let us talk a little about we are going to need.
Concepts:
1. The <symbol> > element defines objects (such as texts, circles, etc.) as a graphic template that will be instantiated by the
Let’s see all things with an example, in our HTML file, inside the body tag we will put the following code:
See like the <symbol> element has its ID attribute which is related to the <use> element, likewise, within the <symbol> element we include the <text> which, as we mentioned, will allow us to draw graphics from letter; in other words, the <use> element will paint on the screen what the element with the ID assigned to it contains within, in this case the <symbol>. element
When you run this code you should get something like this:
It’s not exactly what we want to obtein, so I will add the following CSS code to achieve the goal.
In the previous code, what is really important happened when the <text> element is given styles (the rest is just adding a background color and giving a position to SVG element), if you notice, in the penultimate block of code, we implement the attributes “strock”, which allow us to play with the format of the line of the SVG elements, let’s see what each of them allow us to do:
stroke: set the line color stroke-width: sets the width to the line stroke-dasharray: allows you to display the line as a set of points, its value establishes the length of points that will make up the line stroke-linejoin: sets the shape where the lines meet
Finally, we assign an animation to the <text> element to be able to increase the length of the points that will make up the border of the letters
The result you should obtain is the following:
Tell me, did you get the same result?
/2024/04/crea-textos-con-bordes-animados.html