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

  • SEARCH
  • Home
  • 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 8946241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:27:34+00:00 2026-06-15T12:27:34+00:00

I tried searching for an answer first, but this seems to be an edge

  • 0

I tried searching for an answer first, but this seems to be an edge case.

I’m adding a class to a link via JavaScript (well jQuery actually but I don’t think it matters in this case). The class adds an icon as a background image and some padding. The padding and background image fail to appear on certain links. The problem shows up in IE8, but surprisingly works fine in IE7. I can’t test IE9/10. Works fine in Firefox.

I reduced the code down to a bare minimum and created a jsFiddle that illustrates the problem. http://jsfiddle.net/toxalot/fsdcu/

I’ll try adding the code here.

<style type="text/css">
body { background-color: #fff }
a:hover { background-color: transparent; color: #c30 }
ul { padding-left: 40px }
.iconNewWindowLeave { padding-right: 15px; background-color: #ccc }
</style>
<ul>
    <li style="float: left"><a class="iconNewWindowLeave" href="#">left link</a></li>
    <li style="text-align: right">some stuff on the right</li>
</ul>
<ul>
    <li style="float: left"><a class="linkExternal" href="#">left link</a></li>
    <li style="text-align: right">some stuff on the right</li>
</ul>
<script type="text/javascript">
$('.linkExternal').each(function() {
    $(this).addClass('iconNewWindowLeave');
});
</script>

I’ve removed the image from the example and added a background color for illustration. In IE 8, the second link doesn’t have right padding. Hovering over the link, adds the padding. If I remove the a:hover CSS, hovering doesn’t correct the problem. If I remove the float, the problem goes away. If I remove any of the other CSS, the problem goes away.

So I’ve narrowed down the cause(s), but I don’t know what to do about it. I don’t want to remove or change the existing code. It’s all required for the site layout. If possible, I’d like to add some CSS or JavaScript to fix it. It’s a minor issue, but it’s bugging me. I’m also curious as to whether or not the problem appears in newer versions of IE.

  • 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-06-15T12:27:35+00:00Added an answer on June 15, 2026 at 12:27 pm

    try to add : a display:inline-block; or display:block; to .iconNewWindowLeave

    .iconNewWindowLeave { padding-right: 15px; background-color: #ccc; display:inline-block; }
    

    (not tested)

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

Sidebar

Related Questions

I've tried searching for an answer to this problem, but I'm not entirely sure
Ok, I have tried searching around for this answer, but with no luck. I
I've tried searching on this but can't seem to find an answer anywhere, so
I tried searching for this in many places, but could not find an answer.
Tried searching the site, but cannot find an answer to my problem: Lets say
I tried searching in google but could not find any useful answer, if(verifier.length() >
I tried searching for this but couldn't find a similar question. I have a
I tried searching for information on this, but must not know the right terms
I have tried searching over the internet about this problem but not able to
First post here, I have tried searching but couldn't find what I'm looking for

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.