freeCodeCamp/curriculum/challenges/arabic/01-responsive-web-design/applied-visual-design/change-the-position-of-over...

2.0 KiB

id title challengeType videoUrl localeTitle
587d78a3367417b2b2512acf Change the Position of Overlapping Elements with the z-index Property 0 تغيير موضع تراكب العناصر مع خاصية فهرس z

Description

عندما يتم وضع العناصر للتراكب ، سيظهر العنصر الذي سيأتي لاحقًا في ترميز HTML ، بشكل افتراضي ، في أعلى العناصر الأخرى. ومع ذلك ، يمكن أن تحدد خاصية z-index ترتيب كيفية تكديس العناصر فوق بعضها البعض. يجب أن يكون عددًا صحيحًا (أي عددًا كاملاً وليس عشريًا) ، والقيم الأعلى لخاصية z-index لعنصر ما ، تحركه أعلى في المكدس من تلك ذات القيم الأقل.

Instructions

إضافة خاصية z-index إلى العنصر مع اسم الفئة first (المستطيل الأحمر) وتعيينه إلى قيمة 2 بحيث يغطي العنصر الآخر (المستطيل الأزرق).

Tests

tests:
  - text: يجب أن يحتوي العنصر ذو الصنف <code>first</code> على قيمة <code>z-index</code> 2.
    testString: 'assert($(".first").css("z-index") == "2", "The element with class <code>first</code> should have a <code>z-index</code> value of 2.");'

Challenge Seed

<style>
  div {
    width: 60%;
    height: 200px;
    margin-top: 20px;
  }

  .first {
    background-color: red;
    position: absolute;

  }
  .second {
    background-color: blue;
    position: absolute;
    left: 40px;
    top: 50px;
    z-index: 1;
  }
</style>

<div class="first"></div>
<div class="second"></div>

Solution

// solution required