开发者

Adding HTML5 markup to a MVC3 site

开发者 https://www.devze.com 2023-04-13 07:00 出处:网络
I have already开发者_运维知识库 created a MVC3 site but when I did I didn\'t select the HTML5 markup option. I would like to add some \'safe\' HTML5 markup into the MVC3 site unless there is a way to

I have already开发者_运维知识库 created a MVC3 site but when I did I didn't select the HTML5 markup option. I would like to add some 'safe' HTML5 markup into the MVC3 site unless there is a way to convert the project to use HTML as if I had selected it from the start (is that possible?).

Would I be safe changing the _layout.cshtml to use HTML5 markup such as nav? How do I use my current CSS style sheet to make sure it positions it correctly (is it as simple as adding the class)?

I understand you can select the 'Target Schema For Validation' option to HTML5. Is that mainly for intellisense? Is this one of the primary bi-products of selecting the HTML5 option at project creation time or are there many more impacts other then this target schema and the _layout page?

Thanks much in advance!


There is no magic to the HTML5 support in MVC3. The checkbox in the project template dialog simply creates a different _layout file with <nav> instead of <div>, a reference to modernizr.js, etc. You're free to change the markup of the _layout file to whatever you like.

The schema validation dropdown simply governs what code completion options you get from Intellisense, and what warnings you get when adding markup that does not conform to the schema. But again, if the HTML5 standard gets updated with new tag next week, and Microsoft fails to update Visual Studio, you're free to add markup that doesn't conform to the VS schema.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号