我回答了一个关于如何在悬停子元素时启动动画然后保留应用的样式直到取消悬停父元素的问题.但是,我在我提出的解决方案中发现了一种我无法解释并且我想理解的行为.阅读规范的相关部分对我没有帮助.
这是一个显示预期行为的最小示例.它有效,但由于某些原因,背后有评论的属性必须不同.否则(例如,两者都具有10px值),父母的悬停不会对孩子的宽度做任何事情.JSFiddle.
.parent {
border: 1px solid orange;
padding: 20px;
width: 400px;
}
.parent .child {
display: inline-block;
height: 40px;
background: blue;
transition: width 0.5s ease 600s;
width: 10px; /* why does this value has to be different ... */
/* Hint:
If you hover the child until it reaches the 100px, then hover the
parent without leaving the parent and keeping that hover for the
transition-delay (600s) the width will become 10px as …Run Code Online (Sandbox Code Playgroud)public class Stack {
private LinkedList<? extends Number> stack;
public <T extends Number> void push(T t){
stack.add(t);
}
public <T extends Number>T pop(){
return stack.removeLast();
}
}
Run Code Online (Sandbox Code Playgroud)
添加和删除最后一个方法都会给出编译时错误。请帮助我理解我在这里做错了什么?
推送时出错 -
LinkedList 类型中的方法 add(capture#1-of ? extends Number) 不适用于参数 (T)
弹出错误 -
类型不匹配:无法从 capture#2-of 转换?将 Number 扩展到 T