們經(jīng)常看見(jiàn)某些元素會(huì)上上下下,比如箭頭的指引效果,這個(gè)CSS3就可以完成此動(dòng)作,簡(jiǎn)單好用,親測(cè)。
@-webkit-keyframes bounce-down {
25% {
-webkit-transform: translateY(-10px);
}
50%, 100% {
-webkit-transform: translateY(0);
}
75% {
-webkit-transform: translateY(10px);
}
}
@keyframes bounce-down {
25% {
transform: translateY(-10px);
}
50%, 100% {
transform: translateY(0);
}
75% {
transform: translateY(10px);
}
}
.animate-bounce-down{
-webkit-animation: bounce-down 1.5s linear infinite;
animation: bounce-down 1.5s linear infinite;
}
@-webkit-keyframes bounce-up {
25% {
-webkit-transform: translateY(10px);
}
50%, 100% {
-webkit-transform: translateY(0);
}
75% {
-webkit-transform: translateY(-10px);
}
}
@keyframes bounce-up {
25% {
transform: translateY(10px);
}
50%, 100% {
transform: translateY(0);
}
75% {
transform: translateY(-10px);
}
}
.animate-bounce-up{
-webkit-animation: bounce-up 1.4s linear infinite;
animation: bounce-up 1.4s linear infinite;
}
運(yùn)用
<div class="animate-bounce-up"></div>
--------------------------------
來(lái)源:切圖網(wǎng)(qietu.com)始于2007年,專注web前端開(kāi)發(fā)、培訓(xùn)。
在的移動(dòng)端頁(yè)面中,很多網(wǎng)站都用到了側(cè)邊切換菜單欄功能,針對(duì)于該功能, 利用CSS3的知識(shí),寫(xiě)了一個(gè)實(shí)現(xiàn)側(cè)滑的效果。
效果展示如下:
HTML:首先寫(xiě)好側(cè)邊的布局。然后不是側(cè)邊的內(nèi)容塊最好用一個(gè)內(nèi)容塊包圍住。
CSS樣式
給側(cè)邊菜單定位,起始位置為left:-50%,當(dāng)點(diǎn)擊菜單的展開(kāi)按鈕,側(cè)邊菜單就加上open類目,讓left:值為0,即展開(kāi)切換。同理。main也一樣。
JQ代碼
當(dāng)點(diǎn)擊菜單展開(kāi)按鈕 定義類名為 f-lei,側(cè)邊菜單切換添加刪除類open, 主內(nèi)容切換添加刪除類show。當(dāng)側(cè)邊展開(kāi)時(shí),點(diǎn)擊展開(kāi)的剩余背景能收縮展開(kāi)的菜單欄。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>登錄頁(yè)面</title>
/*總體的樣式*/
<style>
/*盒子樣式*/
#box{
width: 350px; //寬
height: 450px; //高
border: 1px solid black; //邊框
border-radius: 10px; //邊框弧度
font-family: 黑體; //字體
letter-spacing:8px; //段間距
word-spacing: 10px; //字間距
line-height: 40px; //行高
font-size: 18px; //字大小
padding: 20px; //內(nèi)邊框
}
/*給'注冊(cè)'賦予樣式*/
.register{
width:280px ; //寬
height: 50px; //高
background-color: skyblue; //背景顏色
border-radius: 10px; //邊框弧度
}
/*將所有邊框都改變*/
*{
border-radius: 5px; 邊框弧度
}
/*使用class選擇器,賦予number寬高和邊框*/
.number{
width: 185px; //寬
height: 27px; //高
border-width: 1px; //邊框?qū)挾?
}
/*id選擇器*/
#two{
width: 55px; //寬
border-width: 1px; 邊框?qū)挾? }
/*id選擇器*/
#phone{
width: 103px; //寬
}
/*class 選擇器*/
.boxs{
zoom: 75%; //清除浮動(dòng)
color: darkgray; //顏色
}
/*class選擇器*/
.box_a{
width: 50px; //寬
height: 50px; //高
background-image: url("../image/04.jpg "); //背景圖片
background-repeat: no-repeat; // 是否平鋪
background-size: 50px 25px; //背景尺寸
position: relative; //定位 相對(duì)定位
left: 310px; //定位后左移
bottom: 32px; //定位后下移
}
</style>
</head>
<body>
<div id="box">
<h1>請(qǐng)注冊(cè)</h1>
<p style="color: darkgray">已有帳號(hào)?<a href="https://im.qq.com/index">登錄</a></p>
<form action="" method="post">
<label for="name">用戶名</label>
<input type="text" placeholder="請(qǐng)輸入用戶名" id="name" class="number"> <br>
<label for="phone">手機(jī)號(hào)</label>
<select name="" id="two" class="number">
<optgroup>
<option style="" class="">+86</option>
</optgroup>
</select>
<input type="text" placeholder="請(qǐng)輸入手機(jī)號(hào)" id="phone" class="number"> <br>
<label for="mima">密?碼</label>
<input type="password" placeholder="請(qǐng)輸入密碼" id="mima" class="number"> <br>
<label for="mima">驗(yàn)證碼</label>
<input type="password" placeholder="請(qǐng)輸入驗(yàn)證碼" id="is" class="number">
<div class="box_a"></div>
<div class="boxs">
<input type="radio" id="" class="accept">閱讀并接受協(xié)議<br>
</div>
<input type="submit" value="注冊(cè)" class="register" >
</form>
</div>
</body>
</html>
在這里插入圖片描述
*請(qǐng)認(rèn)真填寫(xiě)需求信息,我們會(huì)在24小時(shí)內(nèi)與您取得聯(lián)系。