html - Meta Tags Inside MasterPage Output On One Line -
i clean code , i'm sure developers do. coming across issue meta tags appearing on 1 line , not on separate lines.
i have file called "client.master" , here code header:
<head runat="server"> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="default" /> <meta name="format-detection" content="telephone=no" /> <script src="/scripts/script1.min.js" type="text/javascript"></script> <script src="/scripts/script2.min.js" type="text/javascript"></script> <link rel="apple-touch-icon" href="/images/home-screen.png" /> <link rel="apple-touch-startup-image" href="/images/home-startup.png" /> <link href="/css/thirdparty/xxxxx.min.css" type="text/css" rel="stylesheet" /> <link href="/css/design.css" type="text/css" rel="stylesheet" /> <asp:contentplaceholder id="headcontent" runat="server"> </asp:contentplaceholder> </head>
that looks clean , nice. however, when view source of page, output shows <meta>
tags , <link>
tags on 1 line. the script tags not.
here output of code:
<!doctype html> <html> <head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /><meta name="apple-mobile-web-app-capable" content="yes" /><meta name="apple-mobile-web-app-status-bar-style" content="default" /><meta name="format-detection" content="telephone=no" /> <script src="/scripts/script1.min.js" type="text/javascript"></script> <script src="/scripts/script2.min.js" type="text/javascript"></script> <link rel="apple-touch-icon" href="/images/home-screen.png" /><link rel="apple-touch-startup-image" href="/images/home-startup.png" /><link href="/css/thirdparty/xxxxx.min.css" type="text/css" rel="stylesheet" /><link href="/css/design.css" type="text/css" rel="stylesheet" /> <title> login </title></head>
notice <meta>
, <link>
tags both on single line and <title>
tag has line breaks.
here html default.aspx page title:
<asp:content id="title" runat="server" contentplaceholderid="title"> login </asp:content>
my assumption because <meta>
tags , <link>
tags self enclosed , <script>
tags end </script>
.
is way resolve issue close <meta>
tags </meta>
. way considered standard when closing meta , link tags? or script tags?
thanks in advance help!
if want follow spec, link
, meta
void
elements, can't have closing tag, if doctype
html5, can use selfclosing tag <meta ..../>
default way use start tag, correct conforming use empty
elements don't need end tag (void
ones, said, can't have it).
script not void
element, empty
one, can use start tag, self-closing tag or both start , end tags.
note element have content model of type empty means may empty, not should; called void
.
as why asp parser metas, can't think of reason. understand preference clean code, if of help, try think @ least bug contributes filesize decrease :o)
bear in mind of applies html5, xhtml treats void , empty models differently.
Comments
Post a Comment