1. 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

Discussion in 'Styling and Customization Questions' started by Mike Creuzer, Nov 27, 2011.

  1. Mike Creuzer

    Mike Creuzer Well-Known Member

    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
     
  2. Fuhrmann

    Fuhrmann Well-Known Member

    If I've understood...have you tried this?

    Code:
    @classCustomize.background-color
     
    Mike Creuzer likes this.
  3. Mike Creuzer

    Mike Creuzer Well-Known Member

    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: ;
     
  4. Steve F

    Steve F Well-Known Member

    You can also do:
    Code:
    @property "classCustomize.background";
    @property "/classCustomize.background";
    
     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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 likes this.
  6. Mike Creuzer

    Mike Creuzer Well-Known Member

    Ah I see so pulling just the image is not possible? I could technically just say background-color: transparent !important; but just curious.
     
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Correct. I was unable to get that working.
     
    Mike Creuzer likes this.

Share This Page