Avatar of alupkaman
Flag for China

asked on 

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

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
Microsoft DevelopmentCSS.NET Programming

Avatar of undefined
Last Comment

8/22/2022 - Mon