1

This is my HTML:

    <table id='headerBar'>
        <tr>
        <td class='headerBarActualTd'><a href='/' class='headerBarIconLink'></a><a href='/' id='homeIcon'></a></td>
        <td class='headerBarSpacingTd'></td>
        <td class='headerBarActualTd'><a href='/{{ user.username }}/' class='headerBarIconLink'></a><a href='/{{ user.username }}/' id='myProfileIcon'></a></td>
        <td class='headerBarSpacingTd'></td>
        <td class='headerBarActualTd'><a href='/settings/settingsPage/' class='headerBarIconLink'></a><a href='/' id='settingsIcon'></a></td>
        </tr>
    </table>

and this is my CSS:

#settingsIcon::after {
    content:url('soase.png');
    position: relative;
    width: 43px;
}


#homeIcon:after {
    content:url('soase.png');
    position: relative;
     width: 43px;
}

#myProfileIcon:after {
    content:url('soase.png');
    position: relative;
    width: 43px;
}

In the CSS I set width of the images to 43px but it does not work. The images just appear their regular image size. I even tried using

background-size: 43px;

and that didn't work either. I found this: Can I change the height of an image in CSS :before/:after pseudo-elements?

but it requires me to change

content

to

background-image

but I don't want to do that because background-image was giving my cross browser issues (if I remember correctly, it wasn't showing up correctly on IE.

How do I change the width of the :after element which links to an image using 'content'?

Community
  • 1
  • 1
SilentDev
  • 20,997
  • 28
  • 111
  • 214

1 Answers1

1

You can set overflow: hidden; to ::after and write width and height.

See JsFiddle DEMO

CroaToa
  • 900
  • 2
  • 14
  • 36