简体   繁体   English

如何更改angularJS的默认CSS样式? 搜索框等

[英]How to change angularJS's default css styles? Search box etc

Is there a way to change the default styles of AngularJs search box? 有没有办法更改AngularJs搜索框的默认样式?

 <div ng-controller="PersonListCtrl">
            <div class="bar">Search:
                <input ng-model="query">
            </div>
            <ul class="" ng-show="query">
                <li ng-repeat="person in persons | filter:query">{{person.name}}</li>
            </ul>
        </div>
    </div>

I would like to change the colour and size of the search box and perhaps change the text colour. 我想更改搜索框的颜色和大小,也许还要更改文本的颜色。 I've messed around in the CSS but it doesn't seem to be effecting anything. 我搞砸了CSS,但似乎没有任何影响。

I've tried 我试过了

#bar {

 background-color: #d7d7d7;
color:#000000;
}

and

.bar{

 background-color: #d7d7d7;
color:#000000;
}

AngularJS does not introduces any styles as far as I know. 据我所知,AngularJS没有引入任何样式。 You need to assign the id or the class to the HTML element: 您需要将id或类分配给HTML元素:

<input ng-model="query" id="bar">

or 要么

<input ng-model="query" class="bar">

You're currently targeting the wrapper of the input, you could just use 您当前正在定位输入的包装,您可以使用

.bar input {

instead 代替

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

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