如何在Zend框架中使用条件样式表 $this->headLink()->appendStylesheet('css/css.css')?

11

有人可以帮我解决在IE浏览器中(对于蓝图CSS)怎样编写CSS的问题吗?

我已经完成了。

<?php $headlink = $this->headLink();        
    $headlink->appendStylesheet($this->baseUrl('css/blueprint/screen.css') , 'screen, projection')
        ->appendStylesheet($this->baseUrl('css/blueprint/ie.css'), 'screen, projection', "IE")
        ->appendStylesheet($this->baseUrl('css/blueprint/print.css'));
    echo $headlink;
?>

而且这段代码也没有起作用

<?php $headlink = $this->headLink();        
    $headlink->appendStylesheet($this->baseUrl('css/blueprint/screen.css') , 'screen, projection')
        ->appendStylesheet($this->baseUrl('css/blueprint/ie.css'), 'screen, projection', true)
        ->appendStylesheet($this->baseUrl('css/blueprint/print.css'));
    echo $headlink;
?>
UPDATES::

它应该看起来像这样

<!--[if lt IE 8]><link rel="stylesheet" href="css/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]-->

请在提问时附上您的期望结果和实际结果,以及有关问题发生的路径等信息。请阅读常见问题解答,以便更快地获得帮助并获得更多帮助。 - Samuel Herzog
按照您的要求,已更新。 - S L
2个回答

20
$this->view->headLink()->appendStylesheet('/css/ie.css', 'screen', 'IE');
$this->view->headLink()->appendStylesheet('/css/ie6.css', 'screen', 'IE6'); 

5

你的意思是这样吗?

->appendStylesheet($this->baseUrl('/css/ie6.css'), "screen", 'IE 6')

这段代码中的IE 6可以替换成任何用于引入IE特定样式表的表达式。

希望对您有所帮助。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接