freeCodeCamp/curriculum/challenges/spanish/01-responsive-web-design/applied-visual-design/move-a-relatively-positione...

4.2 KiB

id title challengeType videoUrl localeTitle
587d781e367417b2b2512aca Move a Relatively Positioned Element with CSS Offsets 0 Mueva un elemento de posición relativa con compensaciones de CSS

Description

Las compensaciones de CSS de la top o bottom , y de la left o la right indican al navegador la distancia que debe desplazar un elemento en relación con el lugar donde se ubicaría en el flujo normal del documento. Está desplazando un elemento lejos de un punto dado, lo que lo aleja del lado al que se hace referencia (efectivamente, en la dirección opuesta). Como viste en el último desafío, usando el desplazamiento superior movió el h2 hacia abajo. Del mismo modo, utilizando un desplazamiento a la izquierda mueve un elemento a la derecha.

Instrucciones

Use las compensaciones de CSS para mover el h2 15 píxeles a la derecha y 10 píxeles hacia arriba.

Pruebas

 tests: - text: 'Your code should use a CSS offset to relatively position the <code>h2</code> 10px upwards. In other words, move it 10px away from the <code>bottom</code> of where it normally sits.' testString: 'assert($("h2").css("bottom") == "10px", "Your code should use a CSS offset to relatively position the <code>h2</code> 10px upwards. In other words, move it 10px away from the <code>bottom</code> of where it normally sits.");' - text: 'Your code should use a CSS offset to relatively position the <code>h2</code> 15px towards the right. In other words, move it 15px away from the <code>left</code> of where it normally sits.' testString: 'assert($("h2").css("left") == "15px", "Your code should use a CSS offset to relatively position the <code>h2</code> 15px towards the right. In other words, move it 15px away from the <code>left</code> of where it normally sits.");' 

Semilla de desafío

 <head> <style> h2 { position: relative; } </style> </head> <body> <h1>On Being Well-Positioned</h1> <h2>Move me!</h2> <p>I still think the h2 is where it normally sits.</p> </body> 

Solución

 // solution required 

Instructions

Use las compensaciones de CSS para mover el h2 15 píxeles a la derecha y 10 píxeles hacia arriba.

Tests

tests:
  - text: 'Su código debe usar un desplazamiento de CSS para colocar relativamente el <code>h2</code> 10px hacia arriba. En otras palabras, aléjelo 10px de la <code>bottom</code> de donde normalmente se sienta.'
    testString: 'assert($("h2").css("bottom") == "10px", "Your code should use a CSS offset to relatively position the <code>h2</code> 10px upwards. In other words, move it 10px away from the <code>bottom</code> of where it normally sits.");'
  - text: 'Su código debe usar un desplazamiento de CSS para colocar relativamente el <code>h2</code> 15px hacia la derecha. En otras palabras, aléjelo 15px de la <code>left</code> de donde normalmente se sienta.'
    testString: 'assert($("h2").css("left") == "15px", "Your code should use a CSS offset to relatively position the <code>h2</code> 15px towards the right. In other words, move it 15px away from the <code>left</code> of where it normally sits.");'

Challenge Seed

<head>
<style>
  h2 {
    position: relative;


  }
</style>
</head>
<body>
  <h1>On Being Well-Positioned</h1>
  <h2>Move me!</h2>
  <p>I still think the h2 is where it normally sits.</p>
</body>

Solution

// solution required