content CSS propertyInspect elements/pseudo-elements to see which exact CSS styles are being tested.
::before and ::afterThere should be an icon before the text
There should be an icon after the text
And an icon here --> <-- (base64 URL)
Resizing the image with CSS? (width + height)
Resizing the image with CSS? (width + AUTO height)
:before and :after (for IE8)There should be an icon before the text
There should be an icon after the text
And an icon here --> <-- (base64 URL)
External SVG image with width/height
External SVG without width/height; dimensions set in CSS (should be bigger)
External SVG sprite (symbol)
External SVG sprite (:target)
External SVG sprite, other icon (:target)
The good news: inserting an image as content of a ::before or ::after works everywhere.
The less good news: there are several limitations, so you’re probably better off using background-image if you want to insert a decorative image (using a pseudo-element or not). Some details:
content: url(…) image is a bitmap, it will take its own intrinsic dimensions, and cannot be resized in CSS. Virtually, it’s like the browser is creating the following structure:
<element>
<before>
<img />
</before>
…
</element>
And there is no way to style the generated image.
<symbol> doesn’t work, and using the :target technique works in Firefox and IE but not in Chrome, and makes sizing the image rather tricky.:before and :after syntax, and bitmap images only.