dongpei2835 2014-01-29 07:13
浏览 53

YII - bootstrap css覆盖自定义css规则

I am working on a YII based Web application whose backend is based on bootstrap css. Now on front end YII's bootstrap is overriding custom css rules.

like one example is

tag. following is bootstrap generated css rules

  p {
    font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
    font-size: 13px;
    line-height: 18px;
    margin: 0 0 9px;
  }

We do not have any margin for

but due to margin: 0 0 9px; in bootstrap is effecting
whole page CSS

Issue is that how to override bootstrap rules while using custom CSS. I tired by adding in Action $this->layout='//layouts/main';

but it seems it is picking from Assets folder. Any help much appreciated.

  • 写回答

2条回答 默认 最新

  • dtddjq9637 2014-01-29 07:50
    关注

    One option - to realize backend as a separate module with its own layout or theme (you can add it to the init section of the Module class by setting: Yii::app()->theme = 'themename'; ). For the frontend use a different layout or theme which will not connect bootstrap style files.

    Another option - use a different layout for the frontend controller (public $layout='frontendLayout'; in a Controller class) which also should not be connected bootstrap stylesheets.

    评论

报告相同问题?

悬赏问题

  • ¥15 用C语言输入方程怎么
  • ¥15 网站显示不安全连接问题
  • ¥15 github训练的模型参数无法下载
  • ¥15 51单片机显示器问题
  • ¥20 关于#qt#的问题:Qt代码的移植问题
  • ¥50 求图像处理的matlab方案
  • ¥50 winform中使用edge的Kiosk模式
  • ¥15 关于#python#的问题:功能监听网页
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题