2.1 KiB
2.1 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
bad87fee1348bd9aedf06756 | インラインスタイルでクラス宣言をオーバーライドする | 0 | https://scrimba.com/c/cGJDRha | 18252 | override-class-declarations-with-inline-styles |
--description--
id 宣言は style
要素の CSS で宣言されている場所に関係なく、クラス宣言をオーバーライドすることを証明しました。
CSS をオーバーライドする方法は他にもあります。 インラインスタイルを覚えていますか?
--instructions--
インラインスタイルを使用して、h1
要素を白くしてみましょう。 インラインスタイルは以下のような書き方です:
<h1 style="color: green;">
h1
要素の blue-text
と pink-text
のクラスはそのままにしてください。
--hints--
h1
要素にはクラス pink-text
が必要です。
assert($('h1').hasClass('pink-text'));
h1
要素にはクラス blue-text
が必要です。
assert($('h1').hasClass('blue-text'));
h1
要素には id orange-text
が必要です。
assert($('h1').attr('id') === 'orange-text');
h1
要素にインラインスタイルが必要です。
assert(document.querySelector('h1[style]'));
h1
要素が白で表示されている必要があります。
assert($('h1').css('color') === 'rgb(255, 255, 255)');
--seed--
--seed-contents--
<style>
body {
background-color: black;
font-family: monospace;
color: green;
}
#orange-text {
color: orange;
}
.pink-text {
color: pink;
}
.blue-text {
color: blue;
}
</style>
<h1 id="orange-text" class="pink-text blue-text">Hello World!</h1>
--solutions--
<style>
body {
background-color: black;
font-family: monospace;
color: green;
}
#orange-text {
color: orange;
}
.pink-text {
color: pink;
}
.blue-text {
color: blue;
}
</style>
<h1 id="orange-text" class="pink-text blue-text" style="color: white">Hello World!</h1>