2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
id: bad87fee1348bd9aedf06756
|
|
|
|
title: Override Class Declarations with Inline Styles
|
|
|
|
challengeType: 0
|
|
|
|
videoUrl: 'https://scrimba.com/c/cGJDRha'
|
2019-07-31 11:32:23 -07:00
|
|
|
forumTopicId: 18252
|
2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
## Description
|
|
|
|
<section id='description'>
|
|
|
|
So we've proven that id declarations override class declarations, regardless of where they are declared in your <code>style</code> element CSS.
|
|
|
|
There are other ways that you can override CSS. Do you remember inline styles?
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Instructions
|
|
|
|
<section id='instructions'>
|
2019-10-27 15:45:37 -01:00
|
|
|
Use an inline style to try to make our <code>h1</code> element white. Remember, in line styles look like this:
|
2018-09-30 23:01:58 +01:00
|
|
|
<code><h1 style="color: green;"></code>
|
|
|
|
Leave the <code>blue-text</code> and <code>pink-text</code> classes on your <code>h1</code> element.
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
```yml
|
2018-10-04 14:37:37 +01:00
|
|
|
tests:
|
|
|
|
- text: Your <code>h1</code> element should have the class <code>pink-text</code>.
|
2019-07-24 02:50:51 -07:00
|
|
|
testString: assert($("h1").hasClass("pink-text"));
|
2018-10-04 14:37:37 +01:00
|
|
|
- text: Your <code>h1</code> element should have the class <code>blue-text</code>.
|
2019-07-24 02:50:51 -07:00
|
|
|
testString: assert($("h1").hasClass("blue-text"));
|
2018-10-04 14:37:37 +01:00
|
|
|
- text: Your <code>h1</code> element should have the id of <code>orange-text</code>.
|
2019-07-24 02:50:51 -07:00
|
|
|
testString: assert($("h1").attr("id") === "orange-text");
|
2019-11-20 06:45:19 -08:00
|
|
|
- text: Your <code>h1</code> element should have an inline style.
|
2019-07-24 02:50:51 -07:00
|
|
|
testString: assert(document.querySelector('h1[style]'));
|
2018-10-04 14:37:37 +01:00
|
|
|
- text: Your <code>h1</code> element should be white.
|
2019-07-24 02:50:51 -07:00
|
|
|
testString: assert($("h1").css("color") === "rgb(255, 255, 255)");
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
<div id='html-seed'>
|
|
|
|
|
|
|
|
```html
|
|
|
|
<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>
|
|
|
|
```
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
<section id='solution'>
|
|
|
|
|
2019-04-22 01:57:43 -04:00
|
|
|
```html
|
|
|
|
<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>
|
2018-09-30 23:01:58 +01:00
|
|
|
```
|
2019-07-18 08:24:12 -07:00
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
</section>
|