私はホバー上を回転しているこのサークルを持っていますが、それは中心になく、なぜ(私は '変換元:センターの中心'を追加しましたか)わからない また、 cssについてはごくわずかしか知りませんが、2つの連続したセレクタがある場合はどういう意味ですか?CSSの回転が中心にない
は、ここに私のコードです:
#welcome:hover #welcomeavatar{
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
-ms-transform: rotate(180deg); /* IE 9 */
-webkit-transform: rotate(180deg); /* Chrome, Safari, Opera */
transform: rotate(180deg);
transform-origin : center center;
}
#welcome #welcomeavatar{
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
transform-origin : center center;
}
#welcome:hover #speechbubble{
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
margin-left:120px;
}
#welcome #speechbubble{
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
#welcome #speechbubble{
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
<div id="welcome">
<div id="welcomeavatar"><img src="http://www.for-example.org/img/main/forexamplelogo.png"></div>
<div id="speechbubble"></div>
スニペットは本当に何が起こっているか表示されていないが、あなたは私のコードを持っており、ここで実際の結果だことができますので、それだけだ。www.typhotoshop.tumblr .com
ありがとうございました!
回転している要素(#welcomeavatar)が表示されているため、中心から外れています。ブロック:そのコンテナの幅全体を占めるブロック。 204pxの#welcomeavatarに幅を追加してみてください。 – EricL
実際に#welcomeavatarの幅と高さは200ピクセル(画像と同じ)にする必要があります。次に、イメージにいくつかのスタイルを追加して、ウォブルを取り除く必要があります。画像を表示する:ブロックし、200pxの高さ/幅を追加します。 – EricL
画像と#welcomeavatar要素の寸法が一致せず、画像が正方形ではないため、回転した寸法に一致してもシームレスになりません。あなたの画像は2630x2565という自然な解像度を持っているので、回転にわずかなぐらつきがあります。 –