Enhance Your Designs with CSS3 Animated Text in SVG Artifacts

I am noticing some glitches in text animations/scaling in various modern browsers including Chrome 29, IE10, Safari 5.1 (Windows), Safari 6.0.5 (Mac), and Opera 16. Surprisingly, Firefox (tested with version 23) seems to be working fine on Windows except for Safari 6.

Here's an example:

http://jsfiddle.net/jejPS/1/

If you hover over the "uf" tag, you'll notice that the text scales up. However, when leaving the tag, the letter 'f' may leave a trail while scaling down.

The Background Story:

This is part of a Tag Cloud where SVG elements are generated using our company's internal library (this is hardcoded in the jsfiddle). I've upgraded our implementation to include this scaling feature on hover.

Whether it's using transform: scale(2) or the current font-size transition (:hover -> 2em), I haven't found a way to scale svg-text elements with CSS3/SVG-Animations without encountering these artifacts.

Note: This issue seems to only occur with certain characters like 'f' or 't', regardless of the font used.

I've tried a few workarounds:

Experimenting with different CSS3 properties for better rendering:

-webkit-backface-visibility: hidden;
-webkit-transform: translateZ(0); 
-webkit-transform: translate3d(0,0,0);

Or attempting

-webkit-transform: scale(1.1);

And even trying out

<animateTransform attributeName="transform" attributeType="XML" type="scale" from="2" to="1" additive="sum" begin="mouseover" dur="1s" fill="freeze" />

All these methods resulted in the same effect across all mentioned browsers.

I haven't submitted any bug reports yet as it's hard to believe that WebKit, Presto (Opera), and Internet Explorer 10 would have the same rendering bug. I'm hopeful that there might be another technique out there for scaling text in SVGs that I'm not aware of.

Any help would be greatly appreciated!

edit: typo

Answer №1

An effective workaround that has been found is to include a non-breaking space at the end of your text (e.g. "uf&#160;").

Answer №2

Although this may not be a direct solution, I have found that in similar situations (particularly in Chrome), executing the following dummy update can help:

jQuery('<style></style>').appendTo(jQuery("#gsegMapDiv")).remove();

While it may not be the most elegant solution, it triggers Chrome to recheck its rendering, potentially eliminating artifacts such as those seen when triggering onmouseout in the jsfiddle above.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to vertically align a two-line nav item?

I am looking to design a navigation menu with items that can accommodate one or two lines of text. https://i.sstatic.net/nkxRL.png The items should have consistent height and the text should be vertically centered. Additionally, I want the entire box to ...

My header has a video background that appears aesthetically pleasing on a desktop screen. However, when viewed on a mobile device, it is off-center and doesn't span the full

I am having an issue with a header that has a video background. It looks great on desktop, but on mobile devices, it is only taking up about 2/3 of the screen width and is aligned to the left side instead of filling the entire width. I have tried several ...

Launch the jQuery Fancybox on a separate webpage

I am facing an issue where I have a link in my index.html page and I need it to open a div located in another page named index2.html, but for some reason, it is not working. This is the code I currently have: Link in index.html <a href="#modal" id="o ...

Header Dropdown Problems

Hey there, I have a question regarding my header setup. I currently have two headers in place: Whenever I click the notification button, the dropdown menu seems to disrupt the layout of the header. Here is a screenshot for reference: Below is the CSS cod ...

Changing flexbox positioning for 3 divs on mobile screens

Is it possible to align 3 divs differently based on screen width using Bootstrap flexbox classes? For example, I want them to align like the top image below on small widths (<576px) and like the bottom image below on larger widths (>576px). https:// ...

Employing an odd/even toggle for assigning class names

I need each this.state.title to be aligned based on a different classname. I attempted using css flex boxes/nth-of-type/nth-child, but it didn't work well with React. I'm utilizing this.state to access my objects. My failed strategy render: f ...

The text refuses to line up correctly

I am having trouble aligning my text to the right: #login_status { font-size: 1.2em; text-align: right; display: block; float:right; } Here are the relevant CSS styles: #logo { ...

Is your animation glitching due to axis restrictions?

I decided to create my own version of the Google Maps icon using Photoshop, and now I want to replace the current image with my duplicate when the link that wraps around both is hovered over. To achieve this, I used the position: absolute property to layer ...

The alignment of two responsive divs is off

My goal is to create two responsive columns of divs that stack on top of each other as the screen size decreases. The challenge I am facing is getting these divs to always be centered and sit next to each other, using only inline CSS. <div id="containe ...

Tips on using jQuery to horizontally align an element in the viewport

Although this question has been raised before, my situation is rather unique. I am currently constructing an iframe for future integration into a slideshow component on the website. The challenge lies in the fact that I have a dynamically sized flexbox th ...

Are there any tools available that can convert inline styles into CSS classes?

Can anyone recommend a package that will transform this text: <p style="width: 500px; height: 500px"> Hello World </p> into this format: <p class="foo"> Hello World </p> .foo { width: 500px; height: 500px; } ...

Introducing the World of Wordpress Blogging

How can I create an introduction on my WordPress site similar to the one found at ? I am specifically interested in incorporating the expanding horizon line effect. It seems like it may just be a GIF that plays and then fades into the homepage. Are there ...

Instructions on utilizing clean-css with Node.js to process incoming requests

I need help finding a way to pipe request output into clean-css for minification and then return it as a response. The application I am working on is using restify framework. Here is an example of what I'm trying to accomplish: var url = "http://www ...

What is the strategy used by jQuery to select elements by class name?

Is there a "getElementsByClass" function in JavaScript? If not, how does jQuery manage to do it without looping through all elements which would be very inefficient? Also, how can I specify CSS for elements with two or more classes? <a class="one two ...

Banner advertisement on a webpage

Currently, I am working on a website project for clients who are interested in having background ads displayed throughout the entire site. In terms of coding this feature with CSS, it is relatively straightforward: body { background-image: url('a ...

Adjusting padding evenly across an unspecified number of columns

I'm currently facing a challenge with a multi-column layout. In a basic setup of three columns, I aim to adjust the padding so that each gap between the columns is consistent (2rem). However, the tricky part lies in crafting rules that can be applied ...

Do mobile CSS/HTML have distinct rules to follow?

I am having trouble displaying a background image in CSS. Additionally, I am unable to set a background color for a div. #mlogo { background-image: url(/mobileimages/2015LOGOFB.jpg); background-size: 100%; background-position: top; backgro ...

What are the specific constraints for CSS within web components?

<html> <style> body { color: blue; } </style> <body> <h1>Styles!</h1> <p>someone created a very general selector</p> <isolated-stuff></isolated-stuff> </body> <s ...

Achieving vertical alignment of placeholder in mat-select-field within Angular

I am trying to vertically center a placeholder in a mat-select element. How can I achieve this? It needs to be closer to the bottom of the select input. Here is an image showing my current issue Below are the relevant sections of my code: ...

The accordion won't function properly if it is added using append() after the document is ready

I have implemented a button to add an accordion, but unfortunately it doesn't seem to be working properly. I am unsure of how to troubleshoot and resolve this issue. If the accordion HTML is appended after the document.ready() function, then the accor ...