The standard MVC4 Site.css project does not contain a definition for the display label, editor label, editor

I create a new project / solution in VS2012 (Premium, Update 2) and select the ASP.NET MVC 4 Web Application template. The Site.css site created in the Content folder does not contain definitions for display-label , editor-label , editor-field , etc. But when I let VS2012 create a new View, it creates a view that uses these classes.

Is this normal behavior? Or is there something wrong with my VS2012 installation?

If I create a new ASP.NET MVC 3 Web Application , Site.css contains the definitions.

I believe the new project content comes from C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ProjectTemplates\CSharp\Web\1033\MvcWebApplicationProjectTemplatev4.1.cshtml\Content . The Site.css file in this folder on my computer is dated 2/19/2013 12:36 and has a size of 13.944 bytes. The difference on your computer?

I found this question that seems similar, but in this situation, the code from the MVC3 application was ported to MVC4. In my situation, I just create a new MVC4 application.

+4
source share
1 answer

This may not be the answer, which helps a lot, but it looks like what you saw is the expected behavior. I just created projects in both VS2010 and VS2012 in MVC3 and MVC4, and it seems that the styles of these classes were removed from MVC4, probably because their original style was simply as follows:

 .display-label, .editor-label { margin: 1em 0 0 0; } .display-field, .editor-field { margin: 0.5em 0 0 0; } 

It doesn't hurt to have classes without styles automatically added to these elements, but it provides a default binding for you to apply your own styles, which is probably the reason they left them.

Unfortunately, this is not mentioned in the release notes for ASP.NET MVC 4 .

+1
source

Source: https://habr.com/ru/post/1483018/


All Articles