简体   繁体   English

Zend Framework headLink()帮助器和HTML5

[英]Zend Framework headLink() helper and HTML5

I have set doctype to HTML 5 like this: 我已经将doctype设置为HTML 5,如下所示:

$view->doctype('HTML5');

Then I have added a stylesheet like this: 然后,我添加了一个样式表,如下所示:

$view->headLink()->appendStylesheet($view->baseUrl().'/css/reset.css');

It produces link tag like this: 它产生如下的链接标签:

<link href="/css/reset.css" media="screen" rel="stylesheet" type="text/css" >

But for HTML 5 this would be correct, no? 但是对于HTML 5,这是正确的,不是吗?

<link rel="stylesheet" href="/css/reset.css">

One more question. 还有一个问题。 How to produce meta tag like this with headMeta() helper? 如何使用headMeta()辅助工具生成这样的元标记?

<meta charset="utf-8">

To produce the tag 产生标签

<meta charset="utf-8">

you can do the following. 您可以执行以下操作。

$view->headMeta()->setCharset( 'UTF-8' );

The link tag produced by Zend is correct as well. Zend产生的链接标记也是正确的。 The difference is that Zend tries to be more specific. 区别在于Zend尝试变得更加具体。

Go here to see the different options for the media tag. 转到此处查看media标签的其他选项。

Yours is correct too but the tag Zend displays gives the browser a better idea of how to display you page by telling it what type of display the html document is meant for. 您的也是正确的,但是Zend显示的标签告诉浏览器html文档是什么类型的显示,它使浏览器更好地了解如何显示页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM