2.2 KiB
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
bad87fee1348bd9aedf08746 | Hereda estilos del elemento body | 0 | https://scrimba.com/c/c9bmdtR | 18204 | inherit-styles-from-the-body-element |
--description--
Ahora hemos demostrado que cada página HTML tiene un elemento body
, y que a este elemento body
también se le puede dar estilo con CSS.
Recuerda, puedes dar estilo a tu elemento body
como a cualquier otro elemento HTML, y todos los demás elementos heredarán los estilos del elemento body
.
--instructions--
Primero, crea un elemento h1
con el texto Hello World
Luego, demos el color green
(verde) a todos los elementos de tu página, añadiendo color: green;
a tu declaración de estilo del elemento body
.
Finalmente, da a tu elemento body
un valor para font-family de monospace
añadiendo font-family: monospace;
a la declaración de estilo del elemento body
.
--hints--
Debes crear un elemento h1
.
assert($('h1').length > 0);
Tu elemento h1
debe contener el texto Hello World
.
assert(
$('h1').length > 0 &&
$('h1')
.text()
.match(/hello world/i)
);
Tu elemento h1
debe tener una etiqueta de cierre.
assert(
code.match(/<\/h1>/g) &&
code.match(/<h1/g) &&
code.match(/<\/h1>/g).length === code.match(/<h1/g).length
);
Tu elemento body
debe tener la propiedad color
con el valor green
.
assert($('body').css('color') === 'rgb(0, 128, 0)');
Tu elemento body
debe tener la propiedad font-family
con el valor monospace
.
assert(
$('body')
.css('font-family')
.match(/monospace/i)
);
Tu elemento h1
debe heredar la fuente monospace
de tu elemento body
.
assert(
$('h1').length > 0 &&
$('h1')
.css('font-family')
.match(/monospace/i)
);
Tu elemento h1
debe heredar el color "green" de tu 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>