- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
两件事:首先,当鼠标悬停在线条上时,我很难将线条更改为五种不同的颜色。第二件事,我有一个三 Angular 形和一个圆圈。很像这里的两个红色方 block link ,我想在三 Angular 形上提供 3D 动画,在圆形上提供 2D 效果。
<div class="transform">
<div class="transform-line" id="line">HOVER OVER LINE</div>
<div onmouseover="rotateYDIV()" id="rotate3D">
<img src="http://images3.wikia.nocookie.net/__cb20071127055923/uncyclopedia/images/c/c1/Penrose_triangle.png" alt="3D triangle" />
</div>
<div onmouseover="rotateDIV()" id="rotate2D">
<img src="http://www.collectorsheaven.info/images/products/1168.png" alt="2D circle" />
</div>
</div>
div.transform-line {
font-size: .95em;
text-align: center;
margin: 0px auto;
margin-bottom: 5px;
width: 200px;
/*height: 5px;*/
padding: 2px;
/*background-color: #FF69B4;*/
color: #ffffff;
background-color: HotPink;
transition: width 3s;
/* Chrome and Safari */
-webkit-animation-name: line;
animation-name: line;
}
div.transform-line:hover {
width: 600px;
color: #000000;
}
@-webkit-keyframes W3C
/* Chrome and Safari */
{
0% {
background: Pink;
}
25% {
background: DeepPink;
}
50% {
background: #ffe0e5;
}
75% {
background: HotPink;
}
100% {
background: #ff9baa;
}
}
@keyframes W3C {
0% {
background: Pink;
}
25% {
background: DeepPink;
}
50% {
background: #ffe0e5;
}
75% {
background: HotPink;
}
100% {
background: #ff9baa;
}
}
/***** 2D & 3D *****/
#rotate2D,
#rotate3D {
position: relative;
margin: 10px;
}
我在 JSFiddle 中遇到问题.
最佳答案
您似乎遗漏了一些关于过渡和转换的事情。
您的 CSS 需要进行如下修改才能使这些内容正常工作:
div.transform-line {
font-size: .95em;
text-align: center;
margin: 0px auto;
margin-bottom: 5px;
width: 200px;
padding: 2px;
color: #ffffff;
background-color: HotPink;
}
div.transform-line:hover {
width: 600px;
color: #000000;
/* the animation name has to match the keyframes name below */
animation: W3C 3s;
}
@keyframes W3C {
0% {
background: Pink;
width: 300px;
}
25% {
background: DeepPink;
}
50% {
background: #ffe0e5;
}
75% {
background: HotPink;
}
100% {
background: #ff9baa;
width: 600px;
}
}
/***** circle *****/
#rotate2D {
transition: transform 3s;
transform-origin: 157px 157px;
}
#rotate2D:hover {
transform: rotate(180deg);
}
#rotate3D {
position: relative;
margin: 10px;
transition: transform 3s;
transform-origin: 140px 0;
}
#rotate3D:hover {
transform: rotateY(180deg);
}
关于变换和关键帧动画,有很多需要了解的内容。
W3Schools 不是处理这类事情的最佳资源 - 尝试其中的一些资源。 https://css-tricks.com/snippets/css/keyframe-animation-syntax/
https://css-tricks.com/almanac/properties/t/transform/
http://learn.shayhowe.com/advanced-html-css/css-transforms/
关于CSS 转换技巧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35735544/
我是新手。查看 Google 新闻...上下滚动页面时请注意左侧导航栏。 看看它是如何滚动一点,然后在它消失之前粘在页面顶部的? 关于如何做到这一点有什么想法吗? jQuery 和 CSS 可以复制吗
技巧 1:在 Web 服务器上缓存常用数据 技巧 2:在 Application 或 Session 对象中缓存常用数据 技巧 3:在 Web 服务器磁盘上缓存数据和 HTML 技巧 4:避免
我在 excel 中有一个电子表格,其中包含以下行: COLUMN Value1.Value2.Value3 Value4.Value5.Value6 Value7.Value8.Val
GNU Makefile 中是否有任何技巧来获取规则的所有依赖项? 例子: rule1: dep1_1 dep1_2 dep1_3 rule2: dep2_1 dep2_2 rule1 dump_
人们使用什么来追踪内存泄漏?我已经通过代码检查设法解决了一些问题,但我不知道下一步该做什么/当我的程序变大时我将如何管理问题。我知道我在泄漏什么类型的对象,但我不知道是什么让它保持活力。 在 Wind
有什么好的方法可以将“xlSum”、“xlAverage”和“xlCount”等字符串转换为它们在 Microsoft.Office.Interop.Excel.XlConsolidationFunc
我们都见过这个: javascript:document.body.contentEditable='true'; document.designMode='on';无效 0 但我的问题是,这实际上是
我的应用程序将输出一个图形,其布局由用户定义。自定义布局类应该实现我定义的接口(interface)。我应该怎么做?有一个特殊的文件夹,我可以在其中查找布局类?用户是否将类名作为参数传递给应用? 如有
我在弄清楚如何在 Javascript 中自引用表行时遇到了一些麻烦。 这是简化的代码: $( "#listitems tbody" ).append( "" + "" + id.va
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 6 年前。 Improve this q
我正在将代码库从一种编程风格转移到另一种编程风格。 我们有一个名为 Operand 的类型,定义如下: class Operand {...}; 然后我们有 class OperandFactory
我使用以下缩略图类在我的内容包装器中显示 4x3 缩略图: .thumbnail { float:left; width:300px; height:200px; ma
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我认为这是不可能的,但我想在放弃之前问问你。 我想要类似 constexpr 增量的东西。 #include constexpr int inc() { static int inc = 0;
是否有任何适合 C++ 新手的技术和描述的好列表。我在想一个描述 RAII、RVO、左值的列表……这适用于目前不了解这些技术或来自不适用这些技术的其他语言的新手。 最好是短小精悍的:-) 最佳答案 是
我有一个二进制字符串 '01110000',我想在不编写 forloop 的情况下返回前面的前导零数。有谁知道如何做到这一点?如果字符串立即以“1”开头,最好也返回 0 最佳答案 如果您真的确定它是一
我需要优化我的应用程序的 RAM 使用率。 请省去那些告诉我在编写 Python 代码时不应该关心内存的讲座。我有内存问题,因为我使用非常大的默认字典(是的,我也想快点)。我目前的内存消耗是 350M
有时,当我看到一个我喜欢的网站或来自受人尊敬的人的网站时,我会查看源代码并尝试理解它们(就像我们所有人一样)。 关于 Jeremy Keiths他使用以下代码的网站: [role="navigatio
这是我怎样设置 Git 来管理我的家目录的方法。 我有好几台电脑。一台笔记本电脑用于工作,一台工作站放在家里,一台树莓派(或四台),一台 Pocket CHIP,一台 运行
shell 技巧 表变量 HBase 0.95 版本增加了为表提供 jruby 风格的面向对象引用的 shell 命令。以前,作用于表的所有 shell 命令都具有程序风格,该风格始终将表的名称作
我是一名优秀的程序员,十分优秀!