2.2 KiB
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
bad87fee1348bd9aedf08746 | Herdar estilos do elemento body | 0 | https://scrimba.com/c/c9bmdtR | 18204 | inherit-styles-from-the-body-element |
--description--
No desafio anterior, provamos que cada página HTML tem um elemento body
, e que o elemento body
também pode ser estilizado com CSS.
Lembre-se de que você pode definir o estilo do elemento body
como qualquer outro elemento HTML, e todos os outros elementos herdarão os estilos do elemento body
.
--instructions--
Primeiro, crie um elemento h1
com o texto Hello World
Então, vamos dar a todos os elementos da página a cor green
adicionando color: green;
à declaração de estilo do elemento body
.
Por fim, dê ao elemento body
a tipografia monospace
adicionando font-family: monospace;
à declaração de estilo do elemento body
.
--hints--
Você deve criar um elemento h1
.
assert($('h1').length > 0);
O elemento h1
deve conter o texto Hello World
.
assert(
$('h1').length > 0 &&
$('h1')
.text()
.match(/hello world/i)
);
O elemento h1
deve ter uma tag de fechamento.
assert(
code.match(/<\/h1>/g) &&
code.match(/<h1/g) &&
code.match(/<\/h1>/g).length === code.match(/<h1/g).length
);
O elemento body
deve ter a propriedade color
com o valor green
.
assert($('body').css('color') === 'rgb(0, 128, 0)');
O elemento body
deve ter a propriedade font-family
com o valor monospace
.
assert(
$('body')
.css('font-family')
.match(/monospace/i)
);
O elemento h1
deve herdar a fonte monospace
do elemento body
.
assert(
$('h1').length > 0 &&
$('h1')
.css('font-family')
.match(/monospace/i)
);
O elemento h1
deve herdar a cor verde do elemento body
.
assert($('h1').length > 0 && $('h1').css('color') === 'rgb(0, 128, 0)');
--seed--
--seed-contents--
<style>
body {
background-color: black;
}
</style>
--solutions--
<style>
body {
background-color: black;
font-family: monospace;
color: green;
}
</style>
<h1>Hello World!</h1>