2014-10-09 55 views
2

我一直使用背景大小和媒體查詢成功地使用Smashing Magazine描述的視網膜圖像技術。Retina CSS3僞元素上的圖像

但是,我剛剛發現了一種情況,這種技術看起來不起作用:造型CSS3僞元素。

<p>test</p> 

p:before { 
    content: url('http://file.rspreprod.fr/BNP/Maps/img/web/[email protected]'); 
    background-size: 15px 25px; 
    width:15px; 
    height:25px; 
} 

檢查這個JS小提琴: http://jsfiddle.net/t29xzxmw/2/

在iPhone和Android,圖像不清澈,因爲它應該是。 您是否知道將視網膜圖像應用於CSS3僞元素的解決方案?

+0

是'號碼:before'規則包含適當的媒體查詢中? – 2014-10-09 16:02:33

+0

在我的代碼中,是的,在這個例子中,爲了簡單起見,我刪除了媒體查詢。 – 2014-10-09 16:05:43

+1

這不起作用。它不接受背景大小。它不會因爲它不是背景圖片。 – Christina 2014-10-09 16:07:49

回答

2

使用的background代替content:""

p:before { 
    content:""; 
    background:url('http://file.rspreprod.fr/BNP/Maps/img/web/[email protected]'); 
    background-size: 15px 25px; 
    width:15px; 
    height:25px; 
}