私はすべての研究と試しても解決できない単純な問題があります。私はCSSのプロパティをファイルに移動したい。拳の下のコードスニペット<li>
要素が正しく表示されていません。アウトソーシングのCSSプロパティが機能しません
私のCSSファイル:
.navBarItem
{
padding-left: 0px;
}
私のHTMLファイル:
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js" integrity="sha384-mXQoED/lFIuocc//nss8aJOIrz7X7XruhR6bO+sGceiSyMELoVdZkN7F0oYwcFH+" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity = "sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity = "sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity = "sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous" />
<link rel="stylesheet" href="css/design.css" />
</head>
<body>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-collapse collapse" id="navBar">
<ul class="nav navbar-nav">
<li><a href="#" class="navBarItem">Action</a></li>
<li><a href="#" style="padding-left:0px;">Action</a></li>
</ul>
</div>
</div>
</nav>
</body>
私は私がそのCSSファイルをインポートする場合は特に、別のファイルに指定されたプロパティを置くことは違いはありませんだろうと思いました非常に最後。
それが動作するはずですが、それはもっと複雑です - [この質問](http://stackoverflow.com/questions/2876575/css-rule-priorities)と[MDN:Specificity](https://developer.mozilla.org/en/docs/Web/CSS/)を参照してください。特異性)。あなたのブラウザのコンソールのHTMLタブをチェックして、どのルールがあなたのものよりも優先されているかを確認してください(または '!important'を追加してください)。 – Kenney