課程
/前端開發
/HTML/CSS
/十天精通CSS3
請問怎么才能讓一個物體在圓里面繞著圓轉?
2016-12-19
源自:十天精通CSS3 9-4
正在回答
<!DOCTYPE html>
<html>
<head>
? <meta charset="UTF-8">
? <title>旋轉的小球</title>
? <style type="text/css">
? ?.box {?
? ? ? margin:100px auto;
? ? ? box-sizing: border-box;?
? ? ? background:red;
? ? ? height: 60px; width: 60px;?
? ? ? border-radius: 50%;?
? ? ? /*box-shadow:0 -20px 0 36px green; */
? ? ? box-shadow:inset 0 -20px 0 26px yellow ;?
? ? ? animation: rotate 1s infinite linear;?
? ? }?
? @keyframes rotate{
?0% { transform: rotate(0deg); }
?100% { transform: rotate(360deg); }?
? ?}?
? </style>
</head>
<body>
? <div></div>
</body>
</html>
qq_雪夜_2 提問者
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>無標題文檔</title><style>.box{?width:400px;?height:400px;?border:1px solid #000;?border-radius:100%;?margin:50px auto;?position:relative;}.path{?width:300px;?height:300px;?border:1px dashed #ccc;?border-radius:100%;?position:absolute;?left:50px;?top:50px;}.ball{?width:100px;?height:100px;?background-color:rgba(255,0,0,.8);?border-radius:100%;?position:absolute;?left:50px;?top:50px;?animation:rotate 3s linear infinite;}@keyframes rotate{?from{??transform-origin:150px 150px;??transform:rotate(0deg);?}?to{??transform-origin:150px 150px;??transform:rotate(360deg);?}?}</style></head>
<body><div class="box">?<div class="path"></div>?<div class="ball"></div></div></body></html>
這上面的代碼是正確的嗎?為什么我輸入進去后沒有任何反應
qq_BlackDatura_0
舉報
本課程為CSS3入門教程,深刻詳解CSS3知識讓網頁穿上絢麗裝備
3 回答如何使這兩個半圓合并成一個圓
5 回答如何制作圓角按鈕
6 回答hao繞口,只有一個不就是唯一一個嗎
2 回答如何讓添加一個:target呢?
2 回答如何在body上應用呢
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2016-12-20
<!DOCTYPE html>
<html>
<head>
? <meta charset="UTF-8">
? <title>旋轉的小球</title>
? <style type="text/css">
? ?.box {?
? ? ? margin:100px auto;
? ? ? box-sizing: border-box;?
? ? ? background:red;
? ? ? height: 60px; width: 60px;?
? ? ? border-radius: 50%;?
? ? ? /*box-shadow:0 -20px 0 36px green; */
? ? ? box-shadow:inset 0 -20px 0 26px yellow ;?
? ? ? animation: rotate 1s infinite linear;?
? ? }?
? @keyframes rotate{
?0% { transform: rotate(0deg); }
?100% { transform: rotate(360deg); }?
? ?}?
? </style>
</head>
<body>
? <div></div>
</body>
</html>
2018-06-28
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
<style>
.box{
?width:400px;
?height:400px;
?border:1px solid #000;
?border-radius:100%;
?margin:50px auto;
?position:relative;
}
.path{
?width:300px;
?height:300px;
?border:1px dashed #ccc;
?border-radius:100%;
?position:absolute;
?left:50px;
?top:50px;
}
.ball{
?width:100px;
?height:100px;
?background-color:rgba(255,0,0,.8);
?border-radius:100%;
?position:absolute;
?left:50px;
?top:50px;
?animation:rotate 3s linear infinite;
}
@keyframes rotate{
?from{
??transform-origin:150px 150px;
??transform:rotate(0deg);
?}
?to{
??transform-origin:150px 150px;
??transform:rotate(360deg);
?}?
}
</style>
</head>
<body>
<div class="box">
?<div class="path"></div>
?<div class="ball"></div>
</div>
</body>
</html>
2017-02-27
這上面的代碼是正確的嗎?為什么我輸入進去后沒有任何反應