!important强制此css最强,其它被覆盖


有时我们引用别人写的插件不知道某个样式在哪儿,或者想要覆盖其它样式,就要用到 !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>

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM