2012-03-16 21 views
5

मैं आइकन कक्षाएं बनाने के लिए inline-image फ़ंक्शन का उपयोग कर रहा हूं।एससीएसएस - छवि आयाम प्राप्त करना

.folder { 
    background: inline-image("icons/home/folder.png", 'image/png') no-repeat center; 
    height: image-height("icons/home/folder.png", 'image/png'); 
    width: image-width("icons/home/folder.png", 'image/png'); 
} 

इस तरह कुछ भी मौजूद है:

.folder { 
    background: inline-image("icons/home/folder.png", 'image/png') no-repeat center; 
    height: 30px; 
    width: 41px; 
} 

मैं एक समारोह है कि चौड़ाई और छवि की ऊंचाई निर्धारित कर सकते हैं तो मैं कुछ इस तरह कर सकते हैं रहा हूँ: यह मेरे वर्तमान एससीएसएस है?

उत्तर

8

मिले इस http://compass-style.org/reference/compass/helpers/image-dimensions/

आप सही फ़ंक्शन नाम अनुमान लगाया गया है।

उनका उपयोग करने के लिए आपको कंपास स्थापित करने की आवश्यकता होगी। मैं माउस के लिए स्प्राइट का उपयोग करने की सलाह देंगे वैसे

@import "compass/helpers"; 

.folder { 
    background: inline-image("icons/home/folder.png", 'image/png') no-repeat center; 
    height: image-height("icons/home/folder.png"); 
    width: image-width("icons/home/folder.png"); 
} 

: http://compass-style.org/reference/compass/helpers/sprites/

+0

बस सहायक कार्यों का आयात नहीं किया गया था

वह कुछ इस तरह हो जाएगा। यह भयानक कंपास भी sprites उत्पन्न कर सकते हैं। बदले में sprites के लिए बदल जाएगा। सहायता के लिए धन्यवाद! – sissonb

+0

मुझे विश्वास है कि एक लापता है; @import "कंपास/हेल्पर्स" के बाद। यह इसके बिना संकलित नहीं होगा। –

+0

धन्यवाद @ आर्थर अलाविम – welldan97

संबंधित मुद्दे