Our logo Kybercode
Home
Archive
Articles
Shared
Bits
About
Contact
Home
40 Posts

Archive Articles Shared Bits

About
Contact
RSS
Topics Authors Privacy Policy
Search
CSS Today I Learned Web Dev
Cooper Gidge on Aug 3, 2025.

Use a zero-width, no-break space to make your external link icons wrap with the link text. Even if you use display: inline, the icon won't wrap on Safari (although it will on Chrome and other browsers, which is confusing).

<div>
    <p>Here is a paragraph with <a href="https://example.com/" class="external">a super amazing link</a>, no way!</p>
</div>
.external::after {
    /* Use this zero-width, no-break space */
    content: "\FEFF";
    /* Icon Credit: https://remixicon.com/icon/external-link-line */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='rgb(0,0,255)'%3E%3Cpath d='M10 6V8H5V19H16V14H18V20C18 20.5523 17.5523 21 17 21H4C3.44772 21 3 20.5523 3 20V7C3 6.44772 3.44772 6 4 6H10ZM21 3V11H19L18.9999 6.413L11.2071 14.2071L9.79289 12.7929L17.5849 5H13V3H21Z'%3E%3C/path%3E%3C/svg%3E");
    background-position: center;
    background-size: cover;
    padding-right: 18px;
    white-space: nowrap;
    display: inline;
}
div {
    border: 2px solid #FF0000;
    padding: 10px; 
    width: 300px;
    resize: both;
    overflow: auto;
}
false
Result

For full transparency, ChatGPT helped a bit when coming up with the above solution.

Comments

There are no comments yet. Be the first to post one!

Leave a Comment

Thank you for posting a comment! It will be reviewed and if it passes our checks, it'll be published.

Replying to

This will be publicly displayed with your comment.

Contribute to the conversation! Markdown supported.

Keep Reading

Previous

You're already at the start.

Next Arrays in SQL, the SQL Way

By Cooper Gidge on Jul 7, 2025.

Browse More
The AI Bubble Burst, Just Not In The Way I Was Expecting

By Cooper Gidge on Jan 28, 2025.

Why I Don't Use JavaScript Frameworks

By Cooper Gidge on Jan 19, 2025.

How To Automate Open Graph Images With Eleventy

By Cooper Gidge on Dec 5, 2024.

Featured
Logo Kybercode

All things about software and website development.

RSS
Resources
Home Archive Articles Shared Bits Topics
About
About Contact
Copyright © Kybercode
Privacy Policy
Home
Archive
Articles
Shared
Bits