【发布时间】:2011-01-12 12:43:12
【问题描述】:
我需要在 CSS 中获取另一个属性的值。假设我在 CSS 文件中有这个:
.something {
width: 256px;
}
然后在 something2 中我想使用该值:
.something2 {
width: .something.width;
}
如果没有 JavaScript,我怎么能做到这一点?我之所以需要这个是因为我使用的是 CSS 3 动画:
@-webkit-keyframes somethinghere {
0% {
background-position: -48px 0px;
}
100% {
background-position: .something.width 0px;
}
}
动画结束背景的 x 值我想成为“某物”的宽度。这可以在 CSS (3) 中实现吗?即使它是一个草案规范或只是一个支持它的浏览器,我也想听听。
提前致谢。
【问题讨论】:
标签: css animation attributes