Support » Fixing WordPress » Custom CSS variables

  • Hi I have looked everywhere and have not found any reference to my needs.

    I use custom css for a page on my site But the code has many occouances that need the same setting eg the colour of text, the width of the shadow in “Text shadow” etc on the custom css page is it possible to set varibles,for example
    Text Size = 36px
    Text colour = #000
    shadow size = -2
    Shadow colour = #fff

    then all instances where I want the font colour to be #000 i would insert “text colout”

    Therefor if I need to change the colour of that text I only need to change the variable.

    I hope I am making sense

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Geoffrey Shilling

    (@geoffreyshilling)

    You are making perfect sense. Unfortunately that is not permitted in standard CSS. Depending on how comfortable you are with learning new things, this is possible using a CSS pre-processor such as SASS or Less.

    Thank you for your prompt reply Geoffrey. I know nothing of SASS or Less and therfore fear them. I really want to restrict my code to the particular page, and not affect the rest of the site. I fear upsetting other pages.
    I will take a look and see what they are about.
    Do you think there may be a chance of this functionality b eing wriyyen into CSS.

    Moderator Geoffrey Shilling

    (@geoffreyshilling)

    You’re welcome. It can be intimidating at first, but if you work with CSS much and this is something you would be interested in, you could always focus only on the variables (color names); ignore the rest of SASS/Less altogether. When I was working on front-end development, I had just started to look into those – and mostly for the variables.

    I don’t know too much about it being included in CSS, but I haven’t looked, either. It was in an experimental phase the last I knew. At the rate major changes to CSS and HTML happen, it could be quite a while before there is any standard. Again, that is just based on my limited knowledge of what they are currently working on.

    Good luck!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom CSS variables’ is closed to new replies.