.NET Tips and Tricks

Blog archive

Supporting Newer Versions of HTML in VS2010

By default, Visual Studio supports XHTML 1.0 Transitional, which dates from 2000. HTML has changed since then and you may want to access some newer version. In fact, with all the buzz HTML5 is getting you might be interested in trying it out, which means you'd like to have Visual Studio stop whining at you when you use HTML5 elements and attributes. IntelliSense support would be nice also.

Service Pack 1 for Visual Studio 2010 helps by adding some IntelliSense and validation support for HTML5 to the versions of HTML that Visual Studio supports. But the default remains XHTML 1.0 Transitional from 2000. You can change that.

If you keep the HTML Source Editing menu bar visible, you can change the HTML version easily from a dropdown list on the menu. If you don't, changing the HTML version for your project is a little more awkward. First, go to the Tools | Options menu choice. Once there, from the left-hand treeview, expand the Text Editor node and then the HTML node. Finally, select the Validation node. In the dropdown list on the right, pick the version of HTML you want to use (if you don't see HTML5 then you haven't applied SP1 yet). Maybe it would be easier to just right-mouse click on the menu bar in the editor and add the HTML Source Editing menu -- you can always turn it off when you've made the change.

SP1 support for HTML5 is obviously a stopgap effort. For instance, while the new CSS selectors and color choices won't raise validation errors, you won't get any IntelliSense support either. There are a few bugs in the HTML5 support and no support for some of the new standards like WAI-ARIA (which supports screen readers) and the Microdata vocabularies (which allow you to add metadata to your markup). IntelliSense for JavaScript doesn't appear to have been touched at all.

As of June 19, you can get support for those features (including some of the Microdata vocabularies) by applying the Web Standards Update for Visual Studio SP1 (available here). You must have applied SP1 before applying this update. You can get the update from the Visual Studio Gallery using Visual Studio's Extension Manager on the Tools menu.

It says something about the power of Visual Studio's extensibility that this update was created by the Visual Web Developer Team over their lunch hours.

Of course, while your editor may support these elements, you'll still need to determine whether your users' browser will support them.

Posted by Peter Vogel on 06/28/2011

comments powered by Disqus


  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

  • What's New for Python, Java in Visual Studio Code

    Microsoft announced March 2024 updates to its Python and Java extensions for Visual Studio Code, the open source-based, cross-platform code editor that has repeatedly been named the No. 1 tool in major development surveys.

Subscribe on YouTube