css3 这两个语句对于变换来说是等价的吗?

发布于 2024-12-23 00:21:32 字数 849 浏览 1 评论 0原文

我想知道这两组陈述是否等效。我以为他们是,但他们似乎在做不同的事情。

-webkit-transform: rotate(45deg); 
-webkit-transform: translateX(200px);
-webkit-transform-origin:0% 100%;

并且......

-webkit-transform: rotate(45deg) translateX(200px); 
-webkit-transform-origin:0% 100%;

似乎在第一组语句中,仅执行了translateX,而rotate 没有执行。我将第一组语句的顺序更改为...

-webkit-transform: translateX(200px);
-webkit-transform: rotate(45deg); 
-webkit-transform-origin:0% 100%;

并且它似乎只执行旋转而不是translateX。它只做后一种吗?然而,通过编写...

-webkit-transform: rotate(45deg) translateX(200px); 
-webkit-transform-origin:0% 100%;

它首先进行旋转,然后进行平移X。我认为这应该只是编写它的简写。不是吗?

这是代码的链接。这真的很简单。 http://jsfiddle.net/gCeUe/2/

感谢您的帮助!清晰彻底的帮助将不胜感激=)

i was wondering if these two set of statements are equivalent or not. i thought they were but they seem to be doing different things.

-webkit-transform: rotate(45deg); 
-webkit-transform: translateX(200px);
-webkit-transform-origin:0% 100%;

and...

-webkit-transform: rotate(45deg) translateX(200px); 
-webkit-transform-origin:0% 100%;

it seems that on the first set of statements, only the translateX gets performed and rotate does not. i changed the order around for the first set of statements to...

-webkit-transform: translateX(200px);
-webkit-transform: rotate(45deg); 
-webkit-transform-origin:0% 100%;

and it seems to just perform the rotate and not the translateX. does it just do the latter one? however by writing...

-webkit-transform: rotate(45deg) translateX(200px); 
-webkit-transform-origin:0% 100%;

it does both the rotate first and then the translateX. i thought this was supposed to just be a shorthand of writing it. is it not?

here is a link to the code. it's really simple.
http://jsfiddle.net/gCeUe/2/

thanks for the help! clear and thorough help would be much appreciated = )

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

客…行舟 2024-12-30 00:21:32

CSS 的解析方式使得 last 语句是唯一被渲染的语句:

color: red;
color: green;
color: blue; /* This is what the color will be */

当您像这样编写代码时:

-webkit-transform: rotate(45deg); 
-webkit-transform: translateX(200px);

-webkit-transform 设置为 rotate(45deg),然后用 translateX(200px) 覆盖。

这是正确的语法:

-webkit-transform: rotate(45deg) translateX(200px); 

CSS is parsed in a way so that the last statement is the only one that is rendered:

color: red;
color: green;
color: blue; /* This is what the color will be */

When you write your code like this:

-webkit-transform: rotate(45deg); 
-webkit-transform: translateX(200px);

-webkit-transform is set to rotate(45deg) and then overwritten with translateX(200px).

This is the correct syntax:

-webkit-transform: rotate(45deg) translateX(200px); 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文