<html>
<head>
<style type="text/css">
#sidebar p {
font-family: Verdana;
font-size: .9em; }
#sidebar .intro {
font-family: Georgia;
font-size: 1.25em;
color:red;
}
</style>
</head>
<body>
<div id=”sidebar”>
<p class=”intro”>
As you can see, the more CSS styles you create, the greater the potential for formatting
snafus. For example, you may create a class style specifying a particular
font and font size, but when you apply the style to a paragraph, nothing happens!
This kind of problem is usually related to the cascade. Even though you may think
that directly applying a class to a tag should apply the class’s formatting properties,
it may not if there’s a style with greater specificity.
You have a couple of options for dealing with this kind of problem. First, you can
use !important (as described in the box above) to make sure a property always
applies. The !important approach is a bit heavy handed, though, since it’s hard to
predict that you’ll never, ever, want to overrule an !important property someday.
Read on for two other cascade-tweaking solutions.
</p>
</div>
</body>
</html>
#sidebar pスタイルの特異性は101(IDの場合は100、タグセレクターの場合は1)ですが、.introスタイルの特異性は10(クラスセレクターの場合は10ポイント)です。101は10より大きいため、#sidebarpが優先されます。.introを#sidebar.introに変更すると、その特異性が110に変更されます。
私はこれを変更しましたが、私の結果は来ていません
誰かが私を説明できますか?
出力:赤色、font-size-1.25em、font-family-Georgiaである必要があります