The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › Custom CSS created through JS
Is there a way to repeat the class names inside of CSS or JS to use again.
I am trying to keep minimal HTML. I suspect the custom part would be done entirely through JS.
For example where <name> is the class name in the css file:
Line 27 -> The /work/<name>.png
Line 30 -> The content: “<name>”;
It would then allow me (bearing in mind that I have the image in the right location) the ability to change one word in HTML to update all the content for that div.
I am yet to add a href to the /portfolio/<name> for when you click on the div.
It’s not clear to me what you are trying to do but there is no reason why you couldn’t declare the class name as a variable and re-use it as required.
Your HTML should be minimal anyway but the HTML should also include class declarations as required.
Whether these are applied manually, via PHP (for instance) or JS doesn’t make much difference unless JS is disabled…which some people do.
I’m wondering if you are looking for a CSS pre-processor because, as I said, it’s not clear to me what the ‘issue’ actually is.