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 6913829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:16:03+00:00 2026-05-27T09:16:03+00:00

We use a a[href*=.pdf] CSS selector rule to show a pdf icon when the

  • 0

We use a a[href*=".pdf"] CSS selector rule to show a pdf icon when the href has .pdf as its extension, but the problem is it’s showing for <a> tags with image tags inside them as well as well.

<a href="foo.pdf">foo</a> => Works fine
<a href="foo.pdf"><img src="big_image.gif" /></a> => No good. 

We don’t want to show the PDF icon for this kind of links.

Please let me what kind of CSS selectors we should write for such case?

  • 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-27T09:16:03+00:00Added an answer on May 27, 2026 at 9:16 am

    I’m afraid there isn’t a CSS selector that lets you select links that don’t have <img> tags inside them. (See CSS selector for "foo that contains bar"?.)

    jQuery lets you select links that do contain images via its :has() selector. You could use that to add a class to links with an image inside them, and use that class to turn off your PDF styles.

    Otherwise, you’ll need to add a class to these links on the server.

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

Sidebar

Related Questions

I would use an expression like this $(a[href*='2']).offset().left but for iframe's elements ... I
Can I change the href by javascript? I use the following code in but
I need to use href instead click event so I can use hover in
I use html attribute title to set some hints like this: <a href... title=Go
In a project i use the following code to open a window: window.open(href, 'mysite'
use this website a lot but first time posting. My program creates a number
I want to make this div click-able and want to use same href of
This is probably VERY simple and silly, but I am trying to use jQuery
everyone. I'm trying to use an a href link to onclick toggle unhide and
If location.href.match(i) matches in the URL, how do you use javascript to match 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.