freeCodeCamp/curriculum/challenges/russian/01-responsive-web-design/css-flexbox/use-the-flex-basis-property...

3.0 KiB
Raw Blame History

id title challengeType videoUrl localeTitle
587d78ae367417b2b2512afd Use the flex-basis Property to Set the Initial Size of an Item 0 Используйте свойство flex-basis для установки начального размера элемента

Description

Свойство flex-basis указывает начальный размер элемента до того, как CSS выполнит корректировки с flex-shrink или flex-grow . Единицы, используемые свойством flex-basis такие же, как и другие свойства размера ( px , em , % и т. Д.). Значение auto определяет размеры элементов на основе содержимого.

Instructions

Установите начальный размер ящиков с использованием flex-basis . Добавьте свойство CSS flex-basis как в #box-1 и в #box-2 . Дайте #box-1 значение 10em и #box-2 значение 20em .

Tests

tests:
  - text: 'Элемент <code>#box-1</code> должен иметь свойство <code>flex-basis</code> .'
    testString: 'assert($("#box-1").css("flex-basis") != "auto", "The <code>#box-1</code> element should have a <code>flex-basis</code> property.");'
  - text: '<code>#box-1</code> элемент должен иметь <code>flex-basis</code> значение <code>10em</code> .'
    testString: 'assert(code.match(/#box-1\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?10em;/g), "The <code>#box-1</code> element should have a <code>flex-basis</code> value of <code>10em</code>.");'
  - text: 'Элемент <code>#box-2</code> должен иметь свойство <code>flex-basis</code> .'
    testString: 'assert($("#box-2").css("flex-basis") != "auto", "The <code>#box-2</code> element should have the <code>flex-basis</code> property.");'
  - text: '<code>#box-2</code> элемент должен иметь <code>flex-basis</code> значение <code>20em</code> .'
    testString: 'assert(code.match(/#box-2\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?20em;/g), "The <code>#box-2</code> element should have a <code>flex-basis</code> value of <code>20em</code>.");'

Challenge Seed

<style>
  #box-container {
    display: flex;
    height: 500px;
  }

  #box-1 {
    background-color: dodgerblue;
    height: 200px;

  }

  #box-2 {
    background-color: orangered;
    height: 200px;

  }
</style>

<div id="box-container">
  <div id="box-1"></div>
  <div id="box-2"></div>
</div>

Solution

// solution required