Html ASP.NET MVC 和 HTML5

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16687383/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 08:41:00  来源:igfitidea点击:

ASP.NET MVC and HTML5

htmlasp.net-mvc-4razor

提问by no9

I have been looking into HTML5 and I am really excited to try it out. As a framework I would like to use ASP.NET MVC, but I am unsure how it works with HTML5.

我一直在研究 HTML5,我很高兴能尝试一下。作为一个框架,我想使用 ASP.NET MVC,但我不确定它如何与 HTML5 一起使用。

Are there (i know there are, but not sure if they are good) any good HTML5 toolkits for ASP.NET MVC? Basically i would like some pointers where to start with creating a page with rich HTML5 controls using MVC + some pros and cons from your experience.

是否有(我知道有,但不确定它们是否好)用于 ASP.NET MVC 的任何好的 HTML5 工具包?基本上,我想要一些指针,从哪里开始使用 MVC 创建具有丰富 HTML5 控件的页面 + 从您的经验中得出的一些优点和缺点。

Anyway I am willing to ditch PHP and start with MVC if the HTML support is there... I have C# skills and I understand the MVC pattern.

无论如何,如果有 HTML 支持,我愿意放弃 PHP 并从 MVC 开始......我有 C# 技能并且我了解 MVC 模式。

With best regards, no9.

最好的问候,没有9。

回答by Kimtho6

MVC and HTML 5 don't really have anything to do with each other so you can use any framework you want, its all about the program.

MVC 和 HTML 5 彼此之间没有任何关系,因此您可以使用任何您想要的框架,一切都与程序有关。

And Visual Studio 2012 supports HTML 5 you should install a extension for VS called "Web Essentials 2012" for the best support for HTML 5.

并且 Visual Studio 2012 支持 HTML 5,您应该为 VS 安装一个名为“ Web Essentials 2012”的扩展,以获得对 HTML 5 的最佳支持。

For a good startup you can also check html5boilerplateout.

对于一个好的启动,您还可以检查html5boilerplate

I hope this helps getting you started.

我希望这有助于您入门。

回答by Deano

I wrote an HTML5 toolkit for ASP.NET MVC that you simply add to your project that will give you the functionality that you need.

我为 ASP.NET MVC 编写了一个 HTML5 工具包,您只需将其添加到您的项目中,即可为您提供所需的功能。

Once you have added the library to your project, you can use it in your View like so:

将库添加到项目后,您可以在视图中使用它,如下所示:

@Html.Html5TextBox("txtOne", InputType.Color)

Which will return a textbox element that looks like:

这将返回一个如下所示的文本框元素:

<input type="color" id="txtOne" name="txtOne">

There is loads of support for many other HTML5 input types - for more information, check out the blog post.

对许多其他 HTML5 输入类型提供了大量支持 - 有关更多信息,请查看博客文章