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 4321182
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:42:55+00:00 2026-05-21T08:42:55+00:00

Had a question that I’ve often wondered about. Is it better to have multiple

  • 0

Had a question that I’ve often wondered about. Is it better to have multiple CSS classes that you can use in multiple places across you site i.e.

.padding5 {padding:5px;} 
.margin10 {margin:10px;} 
.left {float:left;}
.right {float:right;} 

So you HTML code looks like this

<div class="padding5 left"> ... </div>

Or rather have explicit classes for every element. i.e.

.title-demo {padding:5px; float:left;}

with HTML

<div class="title-demo"> ... </div>

The obvious advantages of the top organisation are that you save yourself having to repeat CSS over and over and over and your CSS stylesheet is much smaller for larger websites.

Just wondering what’s recommended by the gurus out there? My idea is essentially to create a “hybrid” solution which allows common CSS to be included as “padding5” combined with classes etc ?

  • 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. Editorial Team
    Editorial Team
    2026-05-21T08:42:56+00:00Added an answer on May 21, 2026 at 8:42 am

    NO! Css class names should be descriptive and contextual. You are locking yourself in a maintaince disaster the way you are describing it. What if the padding of padding5 become 10px later? Imagine a class named “blue” that you change the color to red of. You’ll end up with a hell of a website to maintain.

    I suggest using named parts of your website:

     #Agenda {
     }
    
     #Agenda .Item {
     }
    
     #Agenda .Item h1 {
     }
    

    UPDATE after all comments:

    what about giving your website parts that have common properties a conceptual name -> SideBarItem, Acticle, ItemFooter, Widget. And then any element in your website gets a class for one of the named parts and some additional class. <div class="Widget WeatherForecast"> and <div class="Widget CurrencyConverter"> class Widget defines the common properties and the other class the specific properties.

    .Widget {
     padding: 10px;
     float: left;
     margin: 5px;
    }
    
    .WeatherForecast {
     background: red;
     color: white;
    }
    
    .CurrencyConverter {
     background: blue;
     color: black;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It's just a stupid question that I had this morning : Can we use
This is more of a design question that others may have had similar experience
I have what should be a relatively simple question that I can't seem to
I'm playing around with RhinoCommons and NHibernate and I had a question about the
This is a follow-up to a previous question I had about interfaces. I received
Some of the answers to a question I had about redirect_to made me think
I've had a question that I've been wondering for a while. I'm making a
I'm taking an intro class on database management systems, and had a question that
I have a simple question that I am posing mostly for my curiousity. What
I had that question before, tried as answered, but still it does not work.

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.