图解 Flex layout

一个练习flex的小游戏

父级元素属性

  • flex-direction 属性决定主轴的方向(即项目的排列方向)
  • flex-wrap 默认情况下,项目都排在一条线(又称”轴线”)上。flex-wrap属性定义,如果一条轴线排不下,如何换行。
  • flex-flow 属性是flex-direction属性和flex-wrap属性的简写形式,默认值为row nowrap。
  • justify-content属性定义了项目在主轴上的对齐方式。
  • align-items属性定义项目在交叉轴上如何对齐。
  • align-content定义了多根轴线的对齐方式

Read More

Algorithm - Find the next perfect square

Description

https://www.codewars.com/kata/56269eb78ad2e4ced1000013/javascript

Complete the findNextSquare method that finds the next integral perfect square after the one passed as a parameter. Recall that an integral perfect square is an integer n such that sqrt(n) is also an integer.

If the parameter is itself not a perfect square, than -1 should be returned. You may assume the parameter is positive.

Read More