freeCodeCamp/curriculum/challenges/japanese/01-responsive-web-design/css-flexbox/use-the-align-self-property.md

2.1 KiB

id title challengeType videoUrl forumTopicId dashedName
587d78af367417b2b2512b00 align-self プロパティを使用する 0 https://scrimba.com/p/pVaDAv/cMbvzfv 301107 use-the-align-self-property

--description--

フレックスアイテム最後のプロパティは align-self です。 このプロパティでは全アイテムを一括で設定する代わりに、各アイテムの配置を個別に調整できます。 フレックスアイテムには、CSS プロパティ floatclearvertical-align を使う一般的な位置調整テクニックが機能しないので、このプロパティが便利です。

align-selfalign-items と同じ値を受け取り、align-items プロパティで設定された値を上書きします。

--instructions--

CSS プロパティ align-self#box-1#box-2 の両方に追加してください。 #box-1center の値、#box-2flex-end の値を設定してください。

--hints--

#box-1 要素の align-self プロパティを center に設定してください。

assert($('#box-1').css('align-self') == 'center');

#box-2 要素の align-self プロパティを flex-end に設定してください。

assert($('#box-2').css('align-self') == 'flex-end');

--seed--

--seed-contents--

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

    height: 200px;
    width: 200px;
  }

  #box-2 {
    background-color: orangered;

    height: 200px;
    width: 200px;
  }
</style>

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

--solutions--

<style>
  #box-container {
    display: flex;
    height: 500px;
  }
  #box-1 {
    background-color: dodgerblue;
    align-self: center;
    height: 200px;
    width: 200px;
  }

  #box-2 {
    background-color: orangered;
    align-self: flex-end;
    height: 200px;
    width: 200px;
  }
</style>

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