Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

content url is not working in Firefox [closed]

Tags:

html

css

My CSS file is:

        #name_wrong_img
        {
           width:43px;
           height:29px;
        } 

This is my HTML code:

         <img id="name_wrong_img" src="wrong.jpg" />

The above code is working well in both Firefox and Chrome.

        #name_wrong_img
        {
           content:url(wrong.jpg);
           width:43px;
           height:29px;
        } 

         <img id="name_wrong_img"  />

This is working well in Chrome. But not in Firefox. What is the problem in this?

like image 736
selva_pollachi Avatar asked Sep 04 '12 11:09

selva_pollachi


People also ask

Why are links not working in Firefox?

Clear the Cache and remove the Cookies for websites that cause problems via the "3-bar" Firefox menu button (Settings). Start Firefox in Troubleshoot Mode to check if one of the extensions ("3-bar" menu button or Tools -> Add-ons -> Extensions) or if hardware acceleration or userChrome. css is causing the problem.

Why is Firefox not displaying Web pages correctly?

Clear the cookies and cache If a website has updated their code, Firefox may still be using some of the old code along with some of the new, which can make a web page display incorrectly. To fix this, you need to clear the cookies and cache: Click the menu button. to open the menu panel.

How do I make links open in Firefox?

Set Firefox to open links in appsTap the menu button. Tap Settings. Scroll down to the Advanced section, next to Open links in apps use the slider button to turn this ON.


1 Answers

Firefox doesn't support the content property in the same way as Chrome — on img elements and/or when the source is an image.

<img> represents a content image. If you use it, it should have a src and an alt.

From the specification:

The src attribute must be present, and must contain a valid non-empty URL potentially surrounded by spaces referencing a non-interactive, optionally animated, image resource that is neither paged nor scripted.

like image 86
Quentin Avatar answered Oct 24 '22 05:10

Quentin