Home Web Front-end CSS Tutorial css to realize moving cat face

css to realize moving cat face

Nov 18, 2017 am 09:57 AM
css

cssRealize moving cat face, provide free source code~Come and get it to study! ! Follow PHP中文网 to get all kinds of weird source codes for the first time~

css to realize moving cat face

##Code:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

<html>

<head>

    <meta charset="UTF-8">

    <title>PHP中文网</title>

<style>

.face {

   

  left: 50%;

  top: 50%;

  position: absolute;

  width: 400px;

  height: 340px;

  margin-left: -200px;

  margin-top: -170px;

  border-radius: 50% 50% 35% 35%;

  border: 2px solid #000;

  z-index: 10;

  background: #f3f3f3;

  overflow: hidden;

}

 

 

 

.ear-wrap {

  position: absolute;

  width: 400px;

  top: 150px;

  left: 50%;

  margin-left: -200px;

}

.ear {

  width: 160px;

  height: 200px;

  position: absolute;

  top: -22px;

  left: 0;

  border: 2px solid #000;

  background: #f3f3f3;

  transform: rotate(-15deg);

  -ms-transform: rotate(-15deg);

  -moz-transform: rotate(-15deg);

  -webkit-transform: rotate(-15deg);

  -o-transform: rotate(-15deg);

  border-radius: 4% 80% 0% 50%;

  transition: all 1s;

}

.ear-wrap .right {

  left: auto;

  right: 0;

  border-radius: 80% 4% 50% 0%;

  transform: rotate(15deg);

  -ms-transform: rotate(15deg);

  -moz-transform: rotate(15deg);

  -webkit-transform: rotate(15deg);

  -o-transform: rotate(15deg);

}

 

.hair {

  position: absolute;

  width: 180px;

  height: 160px;

  left: 50%;

  margin-left: -90px;

  background: #8d8d8d;

  overflow: hidden;

  border-radius: 0 0 50% 50%;

}

.hair div {

  width: 90px;

  height: 160px;

  background: #f0ac6b;

}

 

 

 

.eye-wrap {

  position: absolute;

  width: 300px;

  height: 60px;

  top: 200px;

  left: 50%;

  margin-left: -150px;

  overflow: hidden;

}

.eye-wrap .eye {

  height: 100px;

  width: 100px;

  position: absolute;

}

.eye-wrap .eye-circle {

  width: 100px;

  height: 100px;

  border: 2px solid #000;

  overflow: hidden;

  position: absolute;

  border-radius: 50%;

  box-sizing: border-box;

}

.eye-wrap .eye-core {

  height: 100px;

  width: 30px;

   

  background: #000;

  position: absolute;

  left: 50%;

  margin-left: -15px;

  transition: all 1s;

}

.eye-wrap .eye-bottom {

  height: 50px;

  width: 160px;

  border-radius: 50%;

  position: absolute;

   

  margin-top: 50px;

  border-top: 2px solid #000;

  left: -30px;

  background: #f6f7f2;

  transition: all 1s;

}

.eye-wrap .right {

  left: auto;

  right: 0px;

}

.eye-red {

  position: absolute;

  height: 28px;

  width: 70px;

  background: red;

  top: 34px;

   

  left: 18px;

  border-radius: 50% 50% 50% 50%;

  background-image: -moz-radial-gradient( 50% 50%, rgba(253,214,240,0.8) 0%, rgba(253,224,244,0.8) 66%, rgba(253,234,247,0.8) 100%);

  background-image: -webkit-radial-gradient( 50% 50%, rgba(253,214,240,0.8) 0%, rgba(253,224,244,0.8) 66%, rgba(253,234,247,0.8) 100%);

  background-image: -ms-radial-gradient( 50% 50%, rgba(253,214,240,0.8) 0%, rgba(253,224,244,0.8) 66%, rgba(253,234,247,0.8) 100%);

  opacity: 0.0;

   

  transition: all 0.1s ease-in 0.2s;

}

 

.nose {

  width: 30px;

  height: 10px;

   

  border-bottom: 8px solid #000;

  border-radius: 0% 0% 50% 50%;

  top: 250px;

  left: 50%;

  margin-left: -15px;

  position: absolute;

}

 

 

.mouth-wrap {

  position: absolute;

  top: 268px;

  width: 100px;

  left: 50%;

  margin-left: -50px;

  height: 20px;

  overflow: hidden;

}

.mouth {

  width: 50px;

  height: 40px;

  border-bottom: 4px solid #000;

  border-right: 4px solid #000;

  border-radius: 0% 40% 50% 20%;

  margin-top: -26px;

  position: absolute;

  left: 0;

  transition: all 1s;

}

.mouth-wrap .right {

   border-bottom: 4px solid #000;

  border-right: none;

  border-left: 4px solid #000;

  border-radius: 40% 0% 20% 50%;

  position: absolute;

  left: auto;

  right: 0;

}

 

 

 

.mustache-wrap {

    height: 80px;

    width: 380px;

    position: absolute;

    top: 190px;

    z-index: 20;

    left: 50%;

    margin-left: -190px;

}

.mustache > div:first-child {

    width: 30px;

    height: 10px;

    border-top: 6px #E53941 solid;

    border-radius: 30% 50% 20% 50%;

    transform: rotate(25deg);

    -ms-transform: rotate(25deg);

    -moz-transform: rotate(25deg);

    -webkit-transform: rotate(25deg);

    -o-transform: rotate(25deg);

    margin-left: 20px;

}

.mustache > div:nth-child(2) {

    width: 20px;

    height: 6px;

    background-color: #E53941;

    border-radius: 50% 50% 50% 50%;

    transform: rotate(25deg);

    -ms-transform: rotate(25deg);

    -moz-transform: rotate(25deg);

    -webkit-transform: rotate(25deg);

    -o-transform: rotate(25deg);

    margin-left: 20px;

}

.mustache > div:nth-child(3) {

     

    width: 32px;

    height: 10px;

    border-bottom: 4px #E53941 solid;

    border-radius: 30% 0% 50% 30%;

    transform: rotate(25deg);

    -ms-transform: rotate(25deg);

    -moz-transform: rotate(25deg);

    -webkit-transform: rotate(25deg);

    -o-transform: rotate(25deg);

    margin-left: 8px;

}

.mustache > div:nth-child(4) {

    margin-top: 20px;

    width: 26px;

    height: 20px;

    border-bottom: 4px #E53941 solid;

    border-radius: 30% 0% 50% 30%;

    transform: rotate(30deg);

    -ms-transform: rotate(30deg);

    -moz-transform: rotate(30deg);

    -webkit-transform: rotate(30deg);

    -o-transform: rotate(30deg);

    margin-left: 28px;

}

.mustache > div:last-child {

    width: 22px;

    height: 10px;

    border-bottom: 3px #E53941 solid;

    border-radius: 0% 0% 50% 50%;

    transform: rotate(-15deg);

    -ms-transform: rotate(-15deg);

    -moz-transform: rotate(-15deg);

    -webkit-transform: rotate(-15deg);

    -o-transform: rotate(-15deg);

    margin-left: 40px;

    margin-top: -8px;

}

 

.mustache-wrap .right {

    transform: rotateY(180deg);

    -webkit-transform: rotateY(180deg);

    -moz-transform: rotateY(180deg);

    margin-top: -85px;

}

 

 

.container:hover .ear-wrap > div:first-child {

     

    transform: rotate(0deg);

    -ms-transform: rotate(0deg);

    -moz-transform: rotate(0deg);

    -webkit-transform: rotate(0deg);

    -o-transform: rotate(0deg);

    border-radius: 4% 80% 0% 60%;

    transition: all 1s;

      

}

 

.container:hover .ear-wrap > div:last-child {

     

    transform: rotate(0deg);

    -ms-transform: rotate(0deg);

    -moz-transform: rotate(0deg);

    -webkit-transform: rotate(0deg);

    -o-transform: rotate(0deg);

    border-radius: 80% 4% 60% 0%;

    transition: all 1s;

     

}

.container:hover .eye-bottom {

  margin-top: 30px;

  transition: all 1s;

}

.container:hover .eye-red {

  opacity: 1;

  transition: all 2.5s;

}

.container:hover .mouth {

  border-radius: 50%;

  transition: all 1s;

}

.container:hover .eye-core {

  width: 40px;

  margin-left: -20px;

  transition: all 1s;

}

</style>

</head>

<body>

  <div class="container">

    <!-- 脸 -->

    <div class="face">

      <!-- 头发 -->

      <div class="hair">

        <div></div>

      </div>

      <!-- 眼睛 -->

      <div class="eye-wrap">

        <div class="eye left">

          <div class="eye-circle">

            <div class="eye-core"></div>

          </div>

          <div class="eye-bottom"></div>

          <div class="eye-red"></div>

        </div>

        <div class="eye right">

          <div class="eye-circle">

            <div class="eye-core"></div>

          </div>

          <div class="eye-bottom"></div>

          <div class="eye-red"></div>

        </div>

      </div>

      <!-- 鼻子 -->

      <div class="nose">

      </div>

      <!-- 嘴巴 -->

      <div class="mouth-wrap">

        <!-- <div class="mouth-top"></div> -->

        <div class="mouth left"></div>

        <div class="mouth right"></div>

      </div>

      <!-- 胡子 -->

      <div class="mustache-wrap">

        <div class="mustache left">

          <div></div>

          <div></div>

          <div></div>

          <div></div>

          <div></div>

        </div>

        <div class="mustache right">

          <div></div>

          <div></div>

          <div></div>

          <div></div>

          <div></div>

        </div>

      </div>

    </div>

    <!-- 耳朵 -->

    <div class="ear-wrap">

      <div class="ear left"> </div>

      <div class="ear right"> </div>

    </div>

  </div>

   

</body>

</html>

Copy after login

Get it for free and study it! More good source codes are available on

PHP Chinese website, follow us and give you a good look~

Related recommendations:

Native js implements movable prompt div box source code

css implements horizontal and vertical elements Centered

html moving puppy source code

The above is the detailed content of css to realize moving cat face. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1267
29
C# Tutorial
1239
24
How to use bootstrap in vue How to use bootstrap in vue Apr 07, 2025 pm 11:33 PM

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

How to insert pictures on bootstrap How to insert pictures on bootstrap Apr 07, 2025 pm 03:30 PM

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

How to write split lines on bootstrap How to write split lines on bootstrap Apr 07, 2025 pm 03:12 PM

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

How to set up the framework for bootstrap How to set up the framework for bootstrap Apr 07, 2025 pm 03:27 PM

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

How to resize bootstrap How to resize bootstrap Apr 07, 2025 pm 03:18 PM

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

How to use bootstrap button How to use bootstrap button Apr 07, 2025 pm 03:09 PM

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

See all articles