【问题标题】:cascading style sheet doesn't work with angular Js级联样式表不适用于角度 Js
【发布时间】:2018-03-04 20:05:21
【问题描述】:

我正在使用带有 angular-ui 引导框架的 angularJs,我的问题是我无法将 css 规则应用于我的网页。

我的 index.html 路线

.state("home",{
        url:"Home",
        views:{
            'main':{templateUrl:"home.html"}
        }
    })

     .state("forum",{
        url:"forum",
        views:{
            'main3':{templateUrl:"forum.html"}
        }
    })

Forum.html ** bg 颜色不是蓝色的!**

<html>
<body style='background-color:blue'>
<h1>Forum</h1>
</body>
</html>

【问题讨论】:

  • 您能否检查控制台中是否存在任何可能的错误?
  • 打开 devtools 并检查此背景重新定义的位置
  • 控制台没有错误
  • 你很可能不想在每个 templateUrl 中都有 html 和 body 标签。
  • 为什么你的模板有html标签?它应该只出现一次

标签: angularjs css angular-ui-router angular-ui-bootstrap


【解决方案1】:

正如 svarog 所暗示的,问题出在标签上,我删除了 Html 和正文标签,我的页面工作正常。

<div  style="background-color:blue">
<div class="tab-content">
<div ui-view="main3">
</div>
<h1>Forum</h1> 
</div>
</div>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-14
    • 2014-07-12
    • 2016-01-14
    • 1970-01-01
    • 2018-09-26
    • 2021-01-23
    • 2019-06-13
    • 2018-09-06
    相关资源
    最近更新 更多