Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<!DOCTYPE html> - Document Type Declaration must appear only once

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.

like image 532
Samantha J T Star Avatar asked Nov 19 '14 09:11

Samantha J T Star


People also ask

What is <! doctype declaration in HTML?

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).

How do I set DOCTYPE to HTML?

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.

How many doctype declaration can a HTML5 document have?

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.

What happens if you miss DOCTYPE HTML?

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.


1 Answers

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.

like image 57
thestephenstanton Avatar answered Sep 30 '22 17:09

thestephenstanton