在 Chrome 83 中,单击<input type="color">小部件时出现的颜色选择器默认为 RGB 输入:
单击字母“B”右侧的两个小箭头,可以将输入格式更改为 HSL 或 HEX。
有没有办法可以将默认输入格式从 RGB 更改为 HEX,或者只允许 HEX 输入?HTML/CSS/JS 将是理想的,但我很好奇是否有 Chrome 设置来调整它。
我正在尝试在CSS中创建一堆扑克牌,其中每张牌都与前一张牌对角略微偏移.这是它的样子:
.card {
float: left;
width: 100px;
height: 140px;
background-color: #fff;
border: 1px solid #000;
border-radius: 5px;
}
.card:nth-child(2) {
margin-left: -98px;
margin-top: -2px;
}
.card:nth-child(3) {
margin-left: -98px;
margin-top: -4px;
}
.card:nth-child(4) {
margin-left: -98px;
margin-top: -6px;
}
/* and so on... */
Run Code Online (Sandbox Code Playgroud)
示例:http://jsfiddle.net/coev55w6/
我知道我可以通过为每张卡指定不同的边距来实现,但我想知道是否有更好的方法.
创建纯粹的水平偏移很容易:
.card {
float: left;
width: 100px;
height: 140px;
background-color: #fff;
border: 1px solid #000;
border-radius: 5px;
}
.card:not(:first-child) {
margin-left: -98px;
}
Run Code Online (Sandbox Code Playgroud)
纯粹垂直也很容易.但有没有办法只用几条CSS规则来获得对角线偏移?
从文档中,Index定义了特征:
pub trait Index<Idx> where Idx: ?Sized {
type Output: ?Sized;
fn index(&self, index: Idx) -> &Self::Output;
}
Run Code Online (Sandbox Code Playgroud)
由于index参数的类型是Idx和否&Idx,因此该index方法需要获取它传递的值的所有权.
有这个限制的原因吗?我知道10次中有9次会使用类似于派生的整数类型的东西Copy,但我只是好奇为什么借用的值会更少能够充当索引.