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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:48:51+00:00 2026-06-13T13:48:51+00:00

Which is better performance wise? <a class=btn loginbtn href=#>Login</a>​ .btn { background: #555 }

  • 0

Which is better performance wise?

<a class="btn loginbtn" href="#">Login</a>​

.btn {
    background: #555 
}
.loginbtn {
    padding: 10px
}​

or

<a class="loginbtn" href="#">Login</a>​

.btn,.loginbtn {
    background: #555  
}
.loginbtn {
    padding: 10px     
}​

Since my CSS will be cached I was thinking the second one would be better.

Help me out please.

  • 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-13T13:48:52+00:00Added an answer on June 13, 2026 at 1:48 pm

    You could calculate the average performance difference caused by the difference in file size as the time it would take to fetch one more TCP/IP package times the probability that it would happen because of that change (i.e. package size divived by the number of characters added).

    You might get something like 10 ms * 1/1000, which would give you 10 µs.

    That is such a small performance difference that you have to make the same thing a huge number of times before it’s noticable.

    So, you should use the one that is clearer and easier to maintain.

    Personally I would go with the first option. I find it easier to see what’s applied to the element if there is a single path to follow from the class names to the rules, rather than having a class scattered across several rules.

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

Sidebar

Related Questions

In ASP.NET which is better performance wise; Localization using the file based resx /
Performance wise which one is better: $(.myclass).eq(0) OR $(a.myclass) Note: If there is only
which is better, performance-wise, when you potentially have an empty list? if (_myList !=
A quick question, which is better performance and memory wise: <t:outputText escape=false value='<tr><td>'/> or
Which method is better (performance-wise) if I have DataBoundControl such as GridView, Repeater, and/or
Which of these queries is better performance wise one uses linq and the other
Which has better execution performance: CSS3 animations, or jQuery animations? How do they affect
Which code snippet will give better performance? The below code segments were written in
Which one is better from performance view user control or custom control? Right now
I am unsure on which approach will give me a better performance: I have

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.