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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:14:58+00:00 2026-06-18T17:14:58+00:00

I want to make a CSS stylesheet that allows completely inexperienced users (using WYSIWYG

  • 0

I want to make a CSS stylesheet that allows completely inexperienced users (using WYSIWYG editors) to have PDF icons next to PDF links. However, this can lead to unwanted stretching of the image with different font sizes. Is there any way I can tell what font size the user has applied to these anchors to then apply the correct icon?

I’m hoping for something as simple as this:

:link[href$=".pdf"]::after,
:visited[href$=".pdf"]::after{
    background-size: 1em !important;
    background-repeat: no-repeat !important;
    background-position: 100% 50% !important;
    color:inherit !important;
    content:" " !important;
    padding-right:1.5em !important;
    text-decoration:inherit !important;
}
:link[href$=".pdf"]::after,
:visited[href$=".pdf"]::after{
    background-image:url('/images/MIME_PDF_16px.png');
}
:link[href$=".pdf"][style.line-height>16px]::after,
:visited[href$=".pdf"][style.line-height>16px]::after{
    background-image:url('/images/MIME_PDF_32px.png');
}
:link[href$=".pdf"][style.line-height>32px]::after,
:visited[href$=".pdf"][style.line-height>32px]::after{
    background-image:url('/images/MIME_PDF_48px.png');
}
:link[href$=".pdf"][style.line-height>48px]::after,
:visited[href$=".pdf"][style.line-height>48px]::after{
    background-image:url('/images/MIME_PDF_64px.png');
}
:link[href$=".pdf"][style.line-height>64px]::after,
:visited[href$=".pdf"][style.line-height>64px]::after{
    background-image:url('/images/MIME_PDF_128px.png');
}

Alternatively, something like this would be nice:

:link[href$=".pdf"]::after,
:visited[href$=".pdf"]::after{
    background-size: 1em !important;
    background-repeat: no-repeat !important;
    background-position: 100% 50% !important;
    color:inherit !important;
    content:" " !important;
    padding-right:1.5em !important;
    text-decoration:inherit !important;
}
:link[href$=".pdf"]::after,
:visited[href$=".pdf"]::after{
    background-image:16px 16px url('/images/MIME_PDF_16px.png'),
                     32px 32px url('/images/MIME_PDF_32px.png'),
                     48px 48px url('/images/MIME_PDF_48px.png'),
                     64px 64px url('/images/MIME_PDF_64px.png'),
                     url('/images/MIME_PDF_128px.png');
}

If no such selector or value exists, then should I propose it to the W3C? Would this go against the philosophy of CSS?

  • 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-18T17:15:00+00:00Added an answer on June 18, 2026 at 5:15 pm

    The problem with a selector that selects by a style property, it is often said, is that it can lead to infinite loops. For example, a selector with a property that attempts to set that same property to another value and back:

    [display=block] { display: none; }
    [display=none] { display: block; }
    

    It’s been proposed several times, I think, and met with rejection. There are of course several counter-arguments and points, such as forbidding the same property from being set in the rule at all, etc, but those are outside the scope of your question so I shan’t elaborate. If you search the mailing list archives, you should be able to find numerous discussions on this matter.

    FWIW, Image Values level 4 actually makes mention of an image-set() function that allows you to specify different images for different resolutions, and I believe some semblance of an implementation can be found in WebKit browsers (naturally, as -webkit-image-set()). However, I don’t think it’s designed to scale with font sizes per se; it’s meant for scaling with resolution from what I can see, which may or may not be a different issue.

    I suppose the safest bet here is to use a vector image format, like SVG, that scales down gracefully yet retains its integrity in large sizes. That way, the image worries about scaling itself so you don’t have to. Judging from your code, I gather that browser support won’t be much of a concern: IE9 supports SVG images just as well as the rest of your CSS code.


    Oh and, since we’re talking about selectors here, :link and :visited will only ever be satisfied by a[href] in HTML. You can make your selectors less redundant by removing those pseudo-classes altogether if you don’t need the pseudo-class specificity, since you already have the appropriate href attribute selector. So instead of this:

    :link[href$=".pdf"]::after, :visited[href$=".pdf"]::after
    

    You can simply do this:

    a[href$=".pdf"]::after
    

    Or even this:

    [href$=".pdf"]::after
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code that is a simple div with a css stylesheet that
Ok so i want to make my border css only applicable to ie8 or
JSFIDDLE EXAMPLE BELOW I want to make the following CSS layout and currently im
I want make datetimepicker in my project. Using jquery how it is possible? I
I have style sheet with a class name changebackgroundcolor i want make change in
I am traversing a HTML document using javascript DOM. I want make a list
i am begginer to jquery and have a simple problem.. I want to make
I want to convert my CSS stylesheet units of measurement from Absolute to Relative.
I have a site using 2 css : one global, one page specific. By
If I update the code on my CSS stylesheet, all pages that pull the

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.