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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:24:13+00:00 2026-05-28T07:24:13+00:00

Suppose I want to decorate links to certain file types using an image. I

  • 0

Suppose I want to decorate links to certain file types using an image. I could declare my links as

<a href='foo.pdf' class='pdflink'>A File!</a>

then have CSS like

.pdflink:after { content: url('/images/pdf.png') }

Now, this works great, except if pdf.png isn’t the right size for my link text.

I’d like to be able to tell the browser to scale the :after image, but I can’t for the life of me find the right syntax. Or is this like background images, where resizing just isn’t possible?

ETA: I’m leaning towards either a) resizing the source image to be the “right” size, server-side and/or b) changing the markup to simply supply an IMG tag inline. I was trying to avoid both those things but they sound like they’ll be more compatible than trying to do stuff purely with CSS. The answer to my original question seems to be “you can sort of do it, sometimes”.

  • 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-28T07:24:13+00:00Added an answer on May 28, 2026 at 7:24 am

    Adjusting the background-size is permitted. You still need to specify width and height of the block, however.

    .pdflink:after {
        background-image: url('/images/pdf.png');
        background-size: 10px 20px;
        display: inline-block;
        width: 10px; 
        height: 20px;
        content:"";
    }
    

    See the full Compatibility Table at the MDN.

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

Sidebar

Related Questions

Suppose I want to have a certain image on the main screen of my
Suppose I want to open a file in an existing Emacs session using su
Suppose we want two constructors for a class representing complex numbers: Complex (double re,
Suppose I want to copy a file: scp abc root@10.10.1.1:/home/user/app_abc is there a way
Suppose I want to create, in the spirit of /dev/zero, a file /dev/seven that
Suppose i want to store 3 lines in a file both in python and
Suppose I want to find out in which package a class is defined, e.g.
Suppose I want to redirect all GET queries from one site to another, using
Suppose I want to read an entire file in memory. I'd open it in
Suppose I want perform a simulation using the following function : fn1 <- function(N)

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.