There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
Agree with a comment or answer? Like () to up-vote the contribution!
Are you sure? Have you tested this hypothesis? Go ahead, and only apply the top: 40px to the first question. (use an id selector or nth, whichever you prefer)
as you see there are 2 div’s with class name question
my output is
image 1
image 2
as you see in Image 1 there is proper 400px gap between top and question 1 but in Image 2 why there is no 400px gap .As i know if i am giving 400px gap from top to class question than every div who have class question should have gap of 400px from top.
now you still apply the top: 400px still to all questions, not only the first one
anyway, as explained earlier (please checkout the jsbin example as well):
So all the questions move down, but because they all move down an equal amount (40px, 400px or whatever value you give them), the relative distance between the questions stays the same.
I added the position - top 40px in the class “question”, There is only changing top of the first question box but why another questions box`s top are not changed? They are also included to class “questions”.
Hi,
Thanks for the responses but still not quite getting this. I played about with your jsbin. This is the start position, before we add relative positioning:
Part 2:
Then added relative positioning. In this example, I see what I would expect - each relatively positioned element has the additional space above it, relative to the last (static) element:
well, in the lab (the codecademy exercise) all questions are positioned relative. which means you have a few relative elements after each other, while in your jsbin example you have relative and static element alternately.
Ah, this is because the answer class element is a sub-element of question class element so we position relative to the previous question as opposed to answer, as I have tried to simulate? (apologies if terminology not correct - early days of learning…)