我正在尝试填充flexbox内的flex项目的垂直空间.
.container {
height: 200px;
width: 500px;
display: flex;
flex-direction: row;
}
.flex-1 {
width: 100px;
background-color: blue;
}
.flex-2 {
position: relative;
flex: 1;
background-color: red;
}
.flex-2-child {
height: 100%;
width: 100%;
background-color: green;
}Run Code Online (Sandbox Code Playgroud)
<div class="container">
<div class="flex-1"></div>
<div class="flex-2">
<div class="flex-2-child"></div>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
这是JSFiddle
flex-2-child 没有填写所需的高度,除非在以下两种情况下:
flex-2 高度为100%(这很奇怪,因为弹性项目默认为100%+ Chrome中存在错误)flex-2-child 有一个绝对的位置也很不方便这在目前的Chrome或Firefox中不起作用.
是否可以使用transform:scale(x)属性,同时保持元素粘在页面底部?(默认情况下,如果比例相对于元素的中心,如下所示)
在state_machine我以前做过
state :cancelled do
validates_presence_of :user
end
Run Code Online (Sandbox Code Playgroud)
如果用户不在,它会自动取消转换.
我们如何在aasm中为特定状态添加类似的验证?
当使用IN语句时,如何按照数组中的id的顺序对结果进行排序:
SELECT id,表名WHERE id IN(23,33,55,2)
我想得到:
+----+---------+
| id | name |
+----+---------+
| 23 | name1 |
| 33 | name2 |
| 55 | name3 |
| 2 | name4 |
+----+---------+
Run Code Online (Sandbox Code Playgroud)
按此顺序