有时我们引用别人写的插件不知道某个样式在哪儿,或者想要覆盖其它样式,就要用到 !importan;
例如以下是引用boostrap,默认bootstrap都是圆边框,我们不想用,例子中同一样式也出现多个importan,则写在最下面的生效。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> .no-radius{ border-radius: 0 !important; } .radius-8{ border-radius: 8px !important; } </style> <link rel="stylesheet" href="../bootstrap-3.3.7-dist/css/bootstrap.css" /> </head> <body style="background: blue;"> <button type="button" class="btn btn-default navbar-btn radius-8 no-radius">Sign in</button> <script src="../jquery-3.3.1.js"></script> <script src="../bootstrap-3.3.7-dist/js/bootstrap.js"></script> </body> </html>