From 526e3331c606a7c198dfe7a2661e0ea5d7e09b2b Mon Sep 17 00:00:00 2001 From: The Coding Aviator <34807532+thecodingaviator@users.noreply.github.com> Date: Sat, 9 Mar 2019 19:42:14 +0530 Subject: [PATCH] Added solution to Change an Element's Relative Position (#34281) * Update index.md * Add full solution --- .../index.md | 53 +++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/guide/english/certifications/responsive-web-design/applied-visual-design/change-an-elements-relative-position/index.md b/guide/english/certifications/responsive-web-design/applied-visual-design/change-an-elements-relative-position/index.md index 1a210e8732..f257625ce1 100644 --- a/guide/english/certifications/responsive-web-design/applied-visual-design/change-an-elements-relative-position/index.md +++ b/guide/english/certifications/responsive-web-design/applied-visual-design/change-an-elements-relative-position/index.md @@ -1,10 +1,57 @@ --- title: Change an Element's Relative Position --- + Remember to use **`Read-Search-Ask`** if you get stuck. Try to pair program  and write your own code  + +###  Problem Explanation: + +* You need to write a CSS selector which will move all the `h2` elements on the page by `15px` from the top. + ## Change an Element's Relative Position -This is a stub. Help our community expand it. +##  Hint: 1 -This quick style guide will help ensure your pull request gets accepted. +Use `position: relative;`. - +> _try to solve the problem now_ + +##  Hint: 2 + +Use the `top: ;` property. + +> _try to solve the problem now_ + +##  Hint: 3 + +Target the `h2` using `h2{}`. + +> _try to solve the problem now_ + + +## Spoiler Alert! + + + +**Solution ahead!** + +```html + +
+I still think the h2 is where it normally sits.
+ +``` + +### Code Explanation: + +* The `h2{}` selects all the `h2` elements on the page where the corresponding stylesheet/styles would be imported/used. +* `position: relative;` sets the `h2` to be positioned relatively, but in normal flow, i.e. it would have no effect on the surrounding element's positions. +* `top: 15px;` moves the `h2` `15px` from the top, as required by the challenge. + +* Note: Changing an element's position to relative does not remove it from the normal flow - other elements around it still behave as if that item were in its default position.