My code looks like this:
<!DOCTYPE html>
<html lang="en"
class="light"
ng-app="app"
ng-controller="appController"
id="ngApp"
xmlns:ng="http://angularjs.org"
xmlns:ui="ui-router">
In Visual Studio 2013 this always gives a problem in the editor and the DOCTYPE is underlined in green with a message saying:
Document Type Declaration must appear only once
Has anyone else found a solution to this problem. Note that with a simple <html>
this does not happen. Code works in the browser but for all versions of VS2013 Update 1-4 I see this green squiggly line under DOCTYPE.
The DOCTYPE declaration is an instruction to the web browser about what version of HTML the page is written in. This ensures that the web page is parsed the same way by different web browsers. In HTML 4.01, the DOCTYPE declaration refers to a document type definition (DTD).
A doctype declaration tells the browser that the page to be rendered is written in HTML. To declare an HTML5 doctype, `<! DOCTYPE html>` is required in the first line of your HTML document.
Types: In the previous versions of HTML, there were different kinds of Doctypes that were declared in each version of HTML, but in HTML5 there is only one type of Doctype available.
The absence of the DOCTYPE or its incorrect usage will force the browser to switch to quirks mode. It means that the browser will do its best to layout the page that is considered to be old or created against web standards.
Check and see if there is a layout file. If you using the template for MVC that Visual Studio provides then your layout file will be located at Views/Shared/_Layout
. There you can see that <!DOCTYPE html>
has already been inserted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With