Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6057705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:31:05+00:00 2026-05-23T08:31:05+00:00

I have some URLs to which I want to add the same image. I’ve

  • 0

I have some URLs to which I want to add the same image. I’ve got the following code:

a.linkArrow
{ 
    background: transparent url('../images/abc.png') no-repeat center right;
    padding-right: 60px;
}

And a link example:

<a class="inkArrow" href="#abc">Abc?</a>

The problem is, the image appears on the left of the text of the link. I want that the image appears always on the right side of the text AND that the distance from the start position of the link text to the start position of the image is always the same. So when I have multiple links in a row that the images of the links align. The image should be clickable and lead to the same url as the link (I’m not sure if it is possible to enclose it in the same tag for this approach.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:31:05+00:00Added an answer on May 23, 2026 at 8:31 am

    You could do this with jQuery too.

    <a href="#" class="imageLink">Some Link</a>
    
    $('.imageLink').each(function(){
       $(this).append(' <img src="YOUR IMAGE HERE">'); 
    });
    

    http://jsfiddle.net/jasongennaro/6Nc3n/

    EDIT:

    I realized that the OP also said the distance from the start position of the link text to the start position of the image is always the same

    So I modified the code

    var finalWidth = 0;
    var getWidth;
    
    $('.imageLink').each(function(){
        getWidth = $(this).width();      
        if(getWidth > finalWidth){
          finalWidth = getWidth;
        }
    });
    
    finalWidth +=15;
    
    $('.imageLink').each(function(){
       var getText = $(this).text();
        $(this).html('<span style="display:inline-block; width:' + finalWidth + 'px;">' + getText + '</span>');
       $(this).append(' <img src="http://icdn.pro/images/en/l/e/left-arrow-icone-3702-32.png">');
       $(this).css('textDecoration','none'); 
    
    });
    

    What this does is get the width of each link text. If checks if that width is the longest, if not ignores, but if yes, then makes it the finalWidth. This finalWidth then added to a new span created around the text and styled with inlineblock.

    Updated Fiddle

    http://jsfiddle.net/jasongennaro/6Nc3n/2/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some URLs in an Excel file which I have saved as a
I want to have URLs like this: some-company-name-deal-id-6.htm So the rewrite rule should ignore
How to add Meta Data explicitly for tabs ? I have some pages which
On a local network, I have some URLs that I want to make easier.
I have some JavaScript which I want to perform a REST Request (GET) to
Ok, so basically I have some bit of code that matches URLs by regexs.
I have a controller which accepts URLs in the following two formats: Network/AddOrEdit ->
I have written some code using express.js which I'd like to put on the
I have a server (nginx) which is routing some urls to static directories, and
I have an MVC 3 application where I want dynamic Urls which do not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.