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