Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 130511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:57:34+00:00 2026-05-11T05:57:34+00:00

I am trying to write the HTML and CSS for an internal webapp properly.

  • 0

I am trying to write the HTML and CSS for an internal webapp properly. As much as technically possible, I want the HTML markup to define the content of the page and be completely independent of what the layout will need to be.

Obviously it is not possible to do this perfectly. I die a little inside every time I have to add an extra nested div for the sole purpose of making the layout work.

The most recent problem I have been trying to tackle is how to reduce the amount of duplicated text in my .css file. The main thing is colors. All throughout my app I use colors to represent ‘clean’, ‘errors’, ‘warnings’, and ‘pardoned’ and so far pretty much every place that uses the colors needs to have them explicitly defined. Sometimes they are used for text colors, sometimes background colors, sometimes border colors.

Is there a way to assign a value such as a color to a name, and then reference that name in the CSS properties?

I am aware of how inheritance works in CSS and I am aware that one method of accomplishing this goal would be to use multiple class names on a lot of my elements and then I could just have backgroundClean be a style that all sorts of objects use. But that requires making the HTML aware of more data that is only relevant to the stylistic layout of the page and not the data, which as I mentioned I would like to avoid.

Bonus Question: What is the best practice for doing this kind of stuff? Am I stupid in trying to make HTML+CSS act like an MVC when it is not ready to do so? I know that is the direction CSS has always been headed but perhaps it’s just not there yet.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:57:35+00:00Added an answer on May 11, 2026 at 5:57 am

    Why yes, there are newly introduced css variables to do this!

    Unfortunetly… it’s not made its way into browsers yet, so you can’t use them, just yet.

    To get the same behavior, you’ll need to use some sort of Server-Side language to output the color dynamically into your CSS files. (You could also use a ton of javascript, but that’d be horrible)

    So in PHP you could do this:

    styles.php--------------------- <?php $warningColor = '#f00'; ?>  .warning {      color: <?=$warningColor?>; } .error {      color: <?=$warningColor?>; }  index.html----------------------  <link rel='stylesheet' src='styles.php' /> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 168k
  • Answers 168k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If an attribute is to contain any {{ }} expressions… May 12, 2026 at 1:46 pm
  • Editorial Team
    Editorial Team added an answer It depends on what programming language you're using. For example,… May 12, 2026 at 1:46 pm
  • Editorial Team
    Editorial Team added an answer You can try using isKindOfClass: instead of isMemberOfClass:. The first… May 12, 2026 at 1:46 pm

Related Questions

I am familiar with CSS techniques to replace text with an image. For example,
I'm trying to get up to speed on HTML/CSS/PHP development and was wondering how
I have used a few different tooltip plugins over the years, but I think
I am struggling to find a way of implementing a tab style menu system

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.