Files
freeCodeCamp/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-basis-property-to-set-the-initial-size-of-an-item.chinese.md
Kristofer Koishigawa b3213fc892 fix(i18n): chinese test suite (#38220)
* fix: Chinese test suite

Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working.

* fix: ran script, updated testStrings and solutions
2020-03-03 18:49:47 +05:30

2.2 KiB
Raw Blame History

id, title, challengeType, videoUrl, forumTopicId, localeTitle
id title challengeType videoUrl forumTopicId localeTitle
587d78ae367417b2b2512afd Use the flex-basis Property to Set the Initial Size of an Item 0 https://scrimba.com/p/pVaDAv/c3d9nCa 301108 使用 flex-basis 属性设置项目的初始大小

Description

flex-basis属性定义了在使用 CSS 的flex-shrinkflex-grow属性对项目进行调整前,项目的初始大小。 flex-basis属性的单位与其他表示尺寸的属性的单位一致(pxem%等)。如果值为auto,则项目的尺寸随内容调整。

Instructions

使用flex-basis为盒子设置初始值。给#box-1#box-2添加 CSS 属性flex-basis。设置#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');
  - 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));
  - text: '<code>#box-2</code>元素应有<code>flex-basis</code>属性。'
    testString: assert($('#box-2').css('flex-basis') != 'auto');
  - 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));

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