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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:43:27+00:00 2026-06-04T03:43:27+00:00

There are 2 methods for external css assignments.I am using the first method; most

  • 0

There are 2 methods for external css assignments.I am using the first method; most websites use the second method. I wonder whether I am doing it wrong!

Fisrt method:

Create a class for almost each & every css rule and use them anywhere.

<div class="f_left d_iblock">
   <span class="w_100 f_left">blah blah</span>
</div>


.f_left{
    float:left;
}
.f_right{
    float:right;
}
.d_block{
    display:block;
}
.w_100{
    width:100%;
}

....
....

Second method:

Create css rules for each element.

<div id="container">
   <span>blah blah</span>
</div>


#container{
   float:left;
   display:inline-block;
}

#container span{
   width:100%;
   float:left;
   font-weight:bold;
}

In general I am using the first method. I am choosing this method because this provides the following to me.

  • Small css files hence provide less load time.
  • Reusable css rules.
  • Clear code hence CSS management is more easier than second method.
  • I don’t need to create an id or class attribute but only assign css rules. So I don’t need to think of a name for each element 🙂
  • I think browsers can interpret css rules fast so this enhances the performance.

I see most sites generally don’t use this method most and I am starting to think that I need to strive to improve performance, but I am bulking html files instead of css with writing 3 to 4 css rule names to each element.

Note:I know little English. I hope you can understand me. I will be happy if you can write simple sentences 🙂

  • 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-06-04T03:43:28+00:00Added an answer on June 4, 2026 at 3:43 am

    Your both method is not so good yet. you can write second method like this:

    #container{
       float:left;
    }
    
    #container span{
       display:block;
       font-weight:bold;
    } 
    

    But your approach for creating a separate class for every property is not good.

    There are some good article you have to read about check these

    https://developers.google.com/speed/docs/best-practices/rendering

    https://developer.mozilla.org/en/Writing_Efficient_CSS

    UPDATED

    Why your approach is not good suppose i have three different element there most of the property is same but are different.

    For Example:

    .one{
     float:left;
     font-family:"tahoma";
     font-weight:bold;
     font-size:15px;
     color:#000;
     line-height:1.5;
    }
    .two{
     float:left;
     font-family:"tahoma";
     font-weight:bold;
     font-size:18px;
     color:#000;
     line-height:1.5;
    }
    .three{
     float:left;
     font-family:"tahoma";
     font-weight:bold;
     font-size:13px;
     color:#000;
     line-height:1.5;
    }
    

    You can write this in a better way which decrease your CSS file size. Write like this:

    .one, .two, .three{
         float:left;
         font-family:"tahoma";
         font-weight:bold;
         font-size:15px;
         color:#000;
         line-height:1.5;
        }
        .two{
         font-size:18px;
        }
        .three{
         font-size:13px;
        }
    

    So, if i go through your approach i have to define each property separately, it’s time consuming & heavy also.

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

Sidebar

Related Questions

In Excel, there are methods to access data from external data sources. Excel comes
Is there some restriction in BizTalk 2006 R2 to accessing static methods in external
I have an external compiled assembly with HtmlHelper extension methods. I need to use
Are there elegant methods for simulating user behavior (clicks, inputs) using JavaScript or PHP?
I've a few web methods that I use to call some external services like
Is there a way to make and use sprites with Rails 3.1 (without external
I need to use an external XML file, I've tried different methods to read
I have certain PHP class methods that access external variables. These variables are not
Are there methods for encoding and decoding XML in .NET? I can't seem to
Are there methods to obfuscate during/after compile that are automated?

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.