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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:59:06+00:00 2026-05-15T07:59:06+00:00

I have a table, with 10 columns. I want to control the width of

  • 0

I have a table, with 10 columns. I want to control the width of each column.
Each column is unique, right now I create an external CSS style for each column:

div#my-page table#members th.name-col
{ width: 40px; }

I know there is a best practice to avoid inline style.
I do approve using external CSS for anything look’n’feel related: fonts, colors, images.
But is it really better to use external CSS in this case?

It does not incur extra maintenance cost.
It is easier to produce.

Cons I can think of:
If you have separate designers and development team – using inline styles will force designers to modify content-file (aspx in my case).
It might use more bandwidth.

Anything else I’ve missed?

IMPORTANT: I am asking about only one specific case where style used will ever apply to exactly one element, and is not part of the global-theme, such as width of one particular column.

  • 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-15T07:59:07+00:00Added an answer on May 15, 2026 at 7:59 am

    There are lots of reasons why style="" is bad. I consider it a bug anywhere I encounter it in my codebase. Here are some reasons:

    1. style= has higher priority than other CSS selectors making it hard to effect changes in the stylesheet; the stylesheet has to work harder to override these.
    2. style= rules are hard to find in the code when you need to make global changes.
    3. You download this CSS code with every page view.
    4. If you have multiple stylesheets for the same HTML codebase your style= rules are not part of the stylesheet and thus are unchangeable.

    However, if you are generating content and it’s difficult to describe this content in a static CSS file, you might also need to generate the CSS to match that content. It is often easier to simply generate style= rules despite the drawbacks. If, however, your generated content can be easily described in a CSS file, because the generated structure doesn’t often change, or because you can easily generate HTML AND a CSS file at the same time, then it’s probably better to not use style=.

    Some suggestions for alternatives to style= that may be appropriate:

    1. Instead of inline styles, use class names. Works well if you have lots of columns in your table that have the same properties, and which you expect to always have the same properties. Then your stylesheet can remain fixed while your HTML is fluid, since the CSS only references classes. This is probably the approach I’d use.
    2. Use JQuery or some other javascript library to style your objects programmatically after the page loads.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with four columns: PartNumber, ValvePartNumber, ActuatorPartNumber, Price I want to
I have four tables containing exactly the same columns, and want to create a
I have an XML column in a table; I want to promote a certain
Hi I want to have two tables each have an INT id column which
I have a repeater control outputting some HTML. I want a table which outputs
I have a table with 5 rows and 2 columns. Each cell contains a
I have a table with a variable number of columns that I want to
I have a table with columns ID, DateStamp and the ID need not be
I have a table with columns Index, Date where an Index may have multiple
I have a table with three columns: user varchar, status varchar , rep int

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.