Home html How to set src attribute of img tag via css?

How to set src attribute of img tag via css?

Author

Date

Category

nothing 🙂


Answer 1, authority 100%


Answer 2, authority 67%

Come on, no way 🙂


Answer 3, authority 33%

You cannot install src img via Css, but you can:

  1. Using divs: & lt; div style = "width: 40px; height: 40px; background-image: url ('address');" & gt; & lt; / div & gt;
  2. In JS using id: & lt; script & gt; document.getElementById ("image id"). src = "address"; & lt; / script & gt;

  3. Answer 4, authority 33%

    I don’t know, it works like this for me, it works in browsers (Yandex, Chrome, Opera, Firefox, Maxthon – these are the ones that I checked)

    div a.link:after {
      content: url (http://savepic.ru/11603915.png)! important;
      }
      img.logo {
      display: none! important;
      } 
    & lt; div & gt;
     & lt; a class = "link" & gt;
      & lt; img class = "logo" src = "/ images / img.jpg" & gt;
      & lt; / a & gt;
    & lt; / div & gt; 

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions