简体   繁体   English

如何用浏览器默认CSS覆盖Materialise CSS?

[英]How to overwrite Materialize CSS with browser default CSS?

I'm making a web application using Javascript, AngularJS and Materialize CSS for my UI. 我正在使用Javascript,AngularJS和Materialize CSS创建Web应用程序。 Materialize CSS has been a great tool so far but I have a problem. 到目前为止,CSS实现是一个不错的工具,但是我有一个问题。

I want to use Angular-Datatables for my tables but I can't because they're being manipulated by Materialize CSS. 我想为我的表使用Angular-Datatables,但是我不能,因为它们被Materialize CSS操纵了。 You don't even have to write anything special, you just write <table> and you're already using Materialize's table. 您甚至不必编写任何特殊内容,只需编写<table> ,您已经在使用Materialize的表。

So my question is: how do I keep using Materialize CSS for everything else, but use the default tables' CSS so I can use Angular-Datatables? 所以我的问题是:如何继续将Materialize CSS用于其他所有内容,而使用默认表的CSS,以便可以使用Angular-Datatables?

Thanks. 谢谢。

EDIT: 编辑:

Here's my HTML code: 这是我的HTML代码:

<table>
    <thead>
        <tr>
            <th style="width:15%"><b>ID</b></th>
            <th style="width:40%"><b>Title</b></th>
            <th style="width:15%"><b>Start Date</b></th>
            <th style="width:20%"><b>End Date</b></th>
            <th style="width:10%"><b>Type</b></th>
        </tr>
    </thead>
    <tbody>
        <tr ng-repeat="task in tasks track by $index">
            <td>{{task.id}}</td>
            <td>{{task.title}}</td>
            <td>{{task.start_day}} {{task.start_time}}</td>
            <td>{{task.end_day}} {{task.end_time}}</td>
            <td>{{task.type}}</td>
        </tr>
    </tbody>
</table>

This code produces the following table: 此代码产生下表:

With angular-datatables, and if you follow their site you just need to change the <table> tag to <table datatable=""> , it looks like this: 对于angular-datatables,如果您关注它们的站点,则只需将<table>标记更改为<table datatable=""> ,它看起来像这样:

You have three choices: 您有三种选择:

1.) Identify the offending rules added by Materialize and overwrite them to match the styling you require in your own style sheet 1.)确定Materialize添加的违规规则,并覆盖它们以匹配您自己的样式表中所需的样式

2.) Use the un-minified version of Materialize and remove the offending styles 2.)使用Materialize的未缩小版本并删除令人讨厌的样式

3.) Remove any table styling from Materialize source and compile the SASS yourself ( https://prepros.io/ this should work to compile your SASS) 3.)从Materialize源代码中删除任何表格样式,然后自己编译SASS( https://prepros.io/这应该可以编译您的SASS)

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

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