2016-07-18 36 views
-1

我需要在Flexslider幻燈片放映中爲導航箭頭設置一個相對URL。背景圖片的相對URL

如何重寫下面的CSS,以便我可以將它應用於不同的網站?

.flex-direction-nav a { 
    width: 50px; 
    height: 50px; 
    margin: -20px 0 0; 
    display: block; 
    background: url(https://example.com/images/slideshow-buttons.png) no-repeat 0 0; 
    position: absolute; 
    top: 50%; 
    cursor: pointer; 
    text-indent: -9999px; 
    opacity: 0; 
    -webkit-transition: all .3s ease; 
    z-index:3; 
} 

回答

0

這是相對於在style.css文件位於

如果css文件是在根或其他文件夾。

如果example.com/style.css這將是:

background: url (images/slideshow-buttons.png) no-repeat 0 0;

如果example.com/css/style.css這將是:

background: url (../images/slideshow-buttons.png) no-repeat 0 0;

+0

感謝@Miro。現在我知道爲什麼我有這麼多麻煩。在很多情況下,我一直試圖在一個子域的測試站點上進行這項工作。這也是一個joomla安裝,所以css文件在一個特定模板的文件夾中。在這種情況下,它看起來像這樣:example.com/testing/templates/template1/css/flexslider.css。現在我會寫這個例子嗎? – user2316544