We help IT Professionals succeed at work.
Get Started

How do I completely disable Visual Studio 2005 from writing inline style attributes?

1,330 Views
Last Modified: 2013-11-27
I use external css style sheets for virtually every style attribute (for a web page). How do I get Visual Studio to completely stop inserting attributes such as style="width:100px"

when I insert a table for example, or work in design view, if I accidentally move anything, VS writes positioning attributes. If I want to insert an inline style, I'll do it myself, but I don't want VS constantly writing width attributes, which override my style sheet for the table, cell, etc. I'm tired of going through every column and removing these because I accidentally bumped something in design view.

I have already tried in Visual Studio, Tools=>Options=>HTML Designer=?CSS Positioning

I have tried unchecking the box completely for positioning attributes. And I have tried checking the box and choosing "no positioning attribute"

This doesn't do anything to solve my problem...does this option even do anything, since the behavior seems to be the same no matter what I check.

So, how do I turn off positioning attributes completely in Visual Studio?? So that if I bump something in design view, such as working with item templates in a form view, there will be no inline styles added?

I can't believe this would even be the default behavior. I understand there are certain situations where inline styles are useful, but 98% of my styles and layouts are defined in the appropriate classes in the external style sheet. So that I can modify everything in one place. It seems counterintuitive to the whole idea of CSS to default to inline styles, since this approach is pretty much the same as the old HTML formatting attributes.

I'm using Visual Studio 2005 Professional Edition.

Kevin Thomas
Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE