VS 2008 is auto changing my CSS file - css

I just migrated an web app from vs 2005 to vs 2008. I use a CSS file with styles for my buttons. In Vs2005, if I assign a style and elect to change it, I would get an inline style for that button, thus creating an exception to my style. In 2008 (also tried this in 2010) it will change the width setting in my CSS file if I resize a button... thus making a global change.
Is there a way to turn this off? I have looked most everywhere and do not see this issue on the web.
thanks

You can use in VS 2010 Skin and Theme to apply formatting to your Button. There is also a SkinId property which allow you to set a specific Style for a Web Control with that the same Id. Have a look at MS reference here http://msdn.microsoft.com/en-us/library/ykzx33wh.aspx

Related

Unable to use CSS to remove a button on a toolbar in Sharepoint Web

I have a weppart page I'm editing in SharePoint Web. I have an excel workbook display webpart in a column. The webpart has a summary toolbar for open in excel, download, and such. The toolbar has multiple buttons displayed to the user that I want to remove. Foe example, the first one is Edit in Excel.
I added a content editor for CSS and used
.cui-ctl-mdedium,
.cui-ctl-mdediumlabel
Display:None;
I've tried multiple classes, targeting just the webpart, using !important and such with no luck. Any thoughts?
Element/Class info
Are you sure you've written that selector correctly? The class name is actually .cui-ctl-mediumlabel ... you've written it with a "1". Not much to do in this case without code or anything to actually try it out. Have you tried solving your problem with your browser's dev tools adding rules?

Asp.net css not working properly after publish

I have an ASP.Net (.net 4.0) page, which contains javascript, css and custom controls.
When I debug the Page, everything looks fine and is working properly. But after publishing, some css don't work anymore. But most of them do. Although they are from the same css file.
I.E.
I have table-data (<td>) tags, which have a select-box in it. In debug, the select-box is visible (width of select: 85%) but in published, the select-box is really thin, because the td doesn't have any width and 85% of 0 is... not much ;).
Also I am not able to hide and unhide divs in my page via JavaScript anymore. I just set display to block or none, but my divs are hidden always, while in debug they work.
I saw problems regarding the including path of css and script files (with root or without root directory etc), tried it but it didn't solve the problem.
Another source said, it would be because of the compatibility mode to .net 3.5, which I changed to 4.0 and it didn't solve the problem, also.
Do you have any idea what could happen here?
For example, the header of a table:
In InternetExplorer while debugging:
And in InternetExplorer after publishing:
You can see there is a gap between the <td> Tags.

Is it possible to change CSS Validation scheme in VS2010

I'm editing a simple CSS file in VS2010 and the editor seems to have a rather limited understanding of CSS, for example:
#my-rule {
position:relative;
}
generates a warning: Validation(CSS 1.0): 'position' is not a known CSS property name
I'm guessing that there is an option some where to change the CSS validation to CSS 2.1 or some thing close, but can't for the life of me find it.
If you want to validate for CSS 3.0 in Visual Studio 2010, you need to install the Visual Studio 2010 Service Pack 1 and then install the "CSS 3 Intellisense Schema"
http://visualstudiogallery.msdn.microsoft.com/7211bcac-091b-4a32-be2d-e797be0db210/view/Discussions
Then you will see "CSS 3.0" in the drop down that easwee mentioned.
You have a dropdown in the top menu where you can switch the css validation. It's called Cascading stylesheet version for validation. If you can't see it right click on the menu and check Style sheet so it will show.

Visual Studio tells me a css class is not defined when clearly it is

I'm using Visual Studio 2008 making an ASP.NET page. In this page I'm using a stylesheet at styles/basic.css
When I hit F5 to load the page it loads perfectly fine. Inside the style sheet I have defined a .basic style class along with other classes. But when I use body class="basic", Visual Studio tells me "The class or CssClass value is not defined."
I've tried to name it body.basic, I've tried renaming basic to a variety of other names, with and without body, but visual studio continues to lie to me and I can't figure out why!
Anyone else come across this/know how to fix it? I noticed one thing - I can use another class name I have: div.opaque, and VS doesn't tell me it's undefined even though it's clearly not a body class? Also I tried renaming it div.basic but that didn't work either.
Well, my current workaround is to just remove the class parameter from the body and just declare body{} in the CSS. Pesky, but works.

How to suppress specific CSS 2.0 validation errors in Visual Studio 2008?

A typical CSS property that I use often is overflow-x or overflow-y. Sometimes I use CSS 2.1 or later properties or selectors. These (correctly) raise a validation error:
Validation (CSS 2.0): 'overflow-y' is not a known CSS property name.
For years I ignored this, but it kinda feels wrong. It's possible to switch off warnings in C# and other languages for a particular line, block, file or project. Is something similar possible for CSS (or HTML) errors or warnings? Instead of switching it all off, I prefer a more granular solution.
If you're willing to muck around a bit you can get exactly what you want.
Go to Visual Studio folder \Common7\Packages\1033\schemas\CSS
Copy css21.xml to css21mod.xml
Find the section:
<cssmd:property-def _locID="overflow" ...
After that section, insert:
<cssmd:property-def
_locID="overflow-x" _locAttrData="description,syntax"
type="enum"
description="Visibility of content extending beyond element's dimensions in x"
syntax="One of the overflow values | inherit"
enum="inherit auto hidden scroll visible"/>
<cssmd:property-def
_locID="overflow-y" _locAttrData="description,syntax" type="enum"
description="Visibility of content extending beyond element's dimensions in y"
syntax="One of the overflow values | inherit"
enum="inherit auto hidden scroll visible"/>
Open regedit, go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Packages\{A764E895-518D-11d2-9A89-00C04F79EFC3}\Schemas
If on 64-bit, you will have to go to SOFTWARE\Wow6432Node\Microsoft etc
Create a new key called Schema 5, and fill in the "File" and "Friendly Name" string values with css21mod.xml and CSS 2.1 (mod)
Should be all set!
Hi I just discovered this. In Visual Studio 2010 SP1 there is support for HTML5 validation.
Tools -> Options -> Text Editor -> HTML -> Validation
Now personally because I hate VS telling me I have duplicate ID's(Which is fine for non server controls) I turn off all warnings and set my validation to XHTML5 (Which is an option).
You can however tweak the settings till your hearts content. Sadly this is not project specific and other team members will need to do the same.
How to make Visual Studio stop "compiling" .js and .css files
Similarly as Jeremy Child suggested, but specific for Visual studio 2008 (as specified in the opriginal question):
Tools -> Options -> Text Editor -> CSS -> CSS Specific : uncheck
"Detect unknown properties"
This removes all CSS validation. This is a good solution if you need the problem to disappear fast (I have no time/bit lazy to manually add each property in an xml file and check the windows registry...) and if you are good in CSS (validation not really needed when you use built-in intellisense or styles that you are sure work -e.g. taken from previous websites you did-).
Get support for CSS 3.0 in order to suppress some of the warnings:
how to make visualstudio 2008 support css v3 & html v5
CSS 3 Intellisense Schema
So this is what happened to me. I had a successfully working project. I made a copy and started working on some label changes. And I started getting
"Validation (CSS 2.0): 'overflow-y' is not a known CSS property name."
The above error kept appearing even after reopening the projects.
So I went back to my original project, opened, started debugging to see if I get that error in that project also. The project successfully. Stopped there. Came to my new error throwing project, and now the error is no longer there.
Something to think about what caused it go away. Something in a memory. May be

Resources