3

CodePen Example: http://codepen.io/haoyuchen1992/pen/XXXMZK

HTML CODE:

<li class = "test" profile="url(http://design.ubuntu.com/wp-content/uploads/ubuntu-logo32.png)" contentDis = "contentDis">
        This is bad!
</li>

CSS CODE:

.test:before {
  right: -80px;
  background-size:cover;
  content:  attr(contentDis);
  background-image: attr(profile);
}

I don't know why the attr function works in content property. But for background-image, the profile string isn't apply correctly.

--- Solution Found!! ---

https://developer.mozilla.org/en-US/docs/Web/CSS/attr

The attr() function can be used with any CSS property, but support for properties other than content is experimental.

other properties are still not supported in major browsers.

Teo
  • 125
  • 1
  • 11
Haoyu Chen
  • 1,760
  • 1
  • 22
  • 32
  • [The attr() function can be used with any CSS property, but **support for properties other than content is experimental.**](https://developer.mozilla.org/en-US/docs/Web/CSS/attr) – j08691 Dec 15 '15 at 17:13
  • @j08691 Thanks! I almost missed the ending words. – Haoyu Chen Dec 15 '15 at 17:14

0 Answers0