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

  • SEARCH
  • Home
  • 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 73681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:14:23+00:00 2026-05-10T20:14:23+00:00

How does one go about establishing a CSS ‘schema’, or hierarchy, of general element

  • 0

How does one go about establishing a CSS ‘schema’, or hierarchy, of general element styles, nested element styles, and classed element styles. For a rank novice like me, the amount of information in stylesheets I view is completely overwhelming. What process does one follow in creating a well factored stylesheet or sheets, compared to inline style attributes?

  • 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-10T20:14:23+00:00Added an answer on May 10, 2026 at 8:14 pm

    I’m a big fan of naming my CSS classes by their contents or content types, for example a <ul> containing navigational ‘tabs’ would have class=’tabs’. A header containing a date could be class=’date’ or an ordered list containing a top 10 list could have class=’chart’. Similarly, for IDs, one could give the page footer id=’footer’ or the logo of the website id=’mainLogo’. I find that it not only makes classes easy to remember but also encourages proper cascading of the CSS. Things like ol.chart {font-weight: bold; color: blue;} #footer ol.chart {color: green;} are quite readable and takes into account how CSS selectors gain weight by being more specific.

    Proper indenting is also a great help. Your CSS is likely to grow quite a lot unless you want to refactor your HTML templates evertime you add a new section to your site or want to publish a new type of content. However hard you try you will inevitably have to add a few new rules (or exceptions) that you didn’t anticipate in your original schema. Indeting will allow you to scan a large CSS file a lot quicker. My personal preference is to indent on how specific and/or nested the selector is, something like this:

        ul.tabs {     list-style-type: none;     }         ul.tabs li {         float: left;         }             ul.tabs li img {             border: none;             } 

    That way the ‘parent’ is always furthest to the left and so the text gets broken up into blocks by parent containers. I also like to split the stylesheet into a few sections; first comes all the selectors for HTML elements. I consider these so generic that they should come first really. Here I put ‘body { font-size: 77%; }’ and ‘a { color: #FFCC00; }’ etc. After that I would put selectors for the main framework parts of the page, for instance ‘ul#mainMenu { float: left; }’ and ‘div#footer { height: 4em; }’. Then on to common object classes, ‘td.price { text-align: right; }’, finally followed by extra little bits like ‘.clear { clear: both; }’. Now that’s just how I like to do it – I’m sure there are better ways but it works for me.

    Finally, a couple of tips:

    1. Make best use of cascades and don’t ‘overclass’ stuff. If you give a <ul> class=’textNav’ then you can access its <li>s and their children without having to add any additional class assignments. ul.textNav li a:hover {}
    2. Don’t be afraid to use multiple classes on a single object. This is perfectly valid and very useful. You then have control of the CSS for groups of objects from more than one axis. Also giving the object an ID adds yet a third axis. For example:

      <style> div.box { float: left; border: 1px solid blue; padding: 1em; }  div.wide { width: 15em;  }  div.narrow { width: 8em;  }  div#oddOneOut { float: right; } </style>  <div class='box wide'>a wide box</div> <div class='box narrow'>a narrow box</div> <div class='box wide' id='oddOneOut'>an odd box</div> 
    3. Giving a class to your document <body> tag (or ID since there should only ever be one…) enables some nifty overrides for individual pages, like hilighting the menu item for the page you’re currently on or getting rid of that redundant second sign-in form on the sign-in page, all using CSS only. ‘body.signIn div#mainMenu form.signIn { display: none; }’

    I hope you find at least some of my ramblings useful and wish you the best with your projects!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 68k
  • Answers 69k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Here's a cunning evaluator class that gives you the JScript.NET… May 11, 2026 at 12:25 pm
  • added an answer We use Robocopy in order to copy identical configuration files… May 11, 2026 at 12:25 pm
  • added an answer The only way I've found to do this is the… May 11, 2026 at 12:25 pm

Related Questions

How does one go about establishing a CSS 'schema', or hierarchy, of general element
How does one go about authoring a Regular Expression that matches against all strings
How does one go about referencing a class's static properties in xaml? In other

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.