yii2 HTML组手

1、样式和脚本

1.1 Yii 提供两个方法用于生成包含内联样式和脚本代码的标签。

<?= Html::style('.danger { color: #f00; }') ?>

Gives you

<style>.danger { color: #f00; }</style>


<?= Html::script('alert("Hello!");', ['defer' => true]);

Gives you

<script defer>alert("Hello!");</script>

1.2 外联 css 样式文件、js文件
<?= Html::cssFile('@web/css/ie5.css', ['condition' => 'IE 5']) ?>

generates

<!--[if IE 5]>
    <link href="http://example.com/css/ie5.css" />
<![endif]-->

<?= Html::jsFile('@web/js/main.js') ?>

2、http://www.yii-china.com/doc/guide/helper_html.html详情

 
posted @ 2017-05-27 17:54  pengcx  阅读(764)  评论(0编辑  收藏  举报