freeCodeCamp/curriculum/challenges/spanish/01-responsive-web-design/basic-css/inherit-styles-from-the-bod...

3.2 KiB

id title challengeType videoUrl localeTitle
bad87fee1348bd9aedf08746 Inherit Styles from the Body Element 0 Heredar estilos del elemento cuerpo

Description

Ahora hemos comprobado que cada página HTML tiene un elemento de body y que su elemento de body también se puede diseñar con CSS. Recuerde, puede diseñar su elemento de body como cualquier otro elemento HTML, y todos los demás elementos heredarán los estilos de su elemento de body .

Instructions

Primero, cree un elemento h1 con el texto Hello World Then, vamos a dar a todos los elementos de su página el color green agregando color: green; a la declaración de estilo de tu elemento body . Finalmente, asigne a su elemento body la familia de fuentes de monospace agregando font-family: monospace; a la declaración de estilo de tu elemento body .

Tests

tests:
  - text: Crear un elemento <code>h1</code> .
    testString: 'assert(($("h1").length > 0), "Create an <code>h1</code> element.");'
  - text: Tu elemento <code>h1</code> debería tener el texto <code>Hello World</code> .
    testString: 'assert(($("h1").length > 0 && $("h1").text().match(/hello world/i)), "Your <code>h1</code> element should have the text <code>Hello World</code>.");'
  - text: Asegúrese de que su elemento <code>h1</code> tenga una etiqueta de cierre.
    testString: 'assert(code.match(/<\/h1>/g) && code.match(/<h1/g) && code.match(/<\/h1>/g).length === code.match(/<h1/g).length, "Make sure your <code>h1</code> element has a closing tag.");'
  - text: Dale a tu <code>body</code> elemento del <code>color</code> la propiedad de <code>green</code> .
    testString: 'assert(($("body").css("color") === "rgb(0, 128, 0)"), "Give your <code>body</code> element the <code>color</code> property of <code>green</code>.");'
  - text: Dale a tu elemento del <code>body</code> la propiedad <code>font-family</code> de <code>monospace</code> .
    testString: 'assert(($("body").css("font-family").match(/monospace/i)), "Give your <code>body</code> element the <code>font-family</code> property of <code>monospace</code>.");'
  - text: Su elemento <code>h1</code> debería heredar la fuente <code>monospace</code> de su elemento de <code>body</code> .
    testString: 'assert(($("h1").length > 0 && $("h1").css("font-family").match(/monospace/i)), "Your <code>h1</code> element should inherit the font <code>monospace</code> from your <code>body</code> element.");'
  - text: Su elemento <code>h1</code> debe heredar el color verde de su elemento de <code>body</code> .
    testString: 'assert(($("h1").length > 0 && $("h1").css("color") === "rgb(0, 128, 0)"), "Your <code>h1</code> element should inherit the color green from your <code>body</code> element.");'

Challenge Seed

<style>
  body {
    background-color: black;
  }

</style>

Solution

// solution required