• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Grab attribute from style property

Mike Creuzer

Well-known member
#1
Hello all,

I've been having a blast with style properties :D. But I was wondering if I could grab the attribute instead of the entire readout. For example, I want to use a CSS Background property type, but I want to use whatever value that is somewhere else.

So here is my code in my css file:

Code:
body {
@property "classCustomize";
color: @contentText;
background: rgb(29, 130, 127) url('js/adstyler/images/bgs/noise_2.png');
@property "/classCustomize";
}
And I want to use the background-color value somewhere else (the background of a node). Can I do this? Or should I instead use scalar (color) and scalar string (for the background image). So that way there are two properties as opposed to one with just multiple CSS options. I hope this is clear, sort of hard to word.

Thanks,
Mike
 

Mike Creuzer

Well-known member
#3
Thanks Fuhrmann, that worked. But there is one thing that doesn't. And that is: background-image: @classCustomize.background-image;

Am I doin that correctly? css.php doesn't send any data, I just get background-image: ;
 

Jake Bunce

XenForo moderator
Staff member
#5
Thanks Fuhrmann, that worked. But there is one thing that doesn't. And that is: background-image: @classCustomize.background-image;

Am I doin that correctly? css.php doesn't send any data, I just get background-image: ;
I have confirmed that doesn't work. But this does:

Code:
@classCustomize.background
To be clear... by specifying "background" and not a particular attribute within background, it pulls the entire CSS attribute. So the above code would output this entire "background" attribute, including the name of the attribute:

Code:
background: rgb(29, 130, 127) url('js/adstyler/images/bgs/noise_2.png');
 

Mike Creuzer

Well-known member
#6
Ah I see so pulling just the image is not possible? I could technically just say background-color: transparent !important; but just curious.