search
HomeWeb Front-endHTML Tutorialcss mouseover animation

css mouseover animation

Nov 18, 2017 am 11:55 AM
cssanimation

cssImplementationmouseover animation, free source code, you can study and refer to it or use it~~

css mouseover animation

Code:

<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>PHP中文网--CSS3鼠标悬停动画</title>
		<style type="text/css">

			body {
				margin: 200px;
				text-align: center;
				font: 1em "微软雅黑";
			}
			/*去掉li的点或者顺序*/
			ul,ol,li {
				list-style-type: none;
				vertical-align: 0
			}
			/*去掉超链接底下的横线*/
			a {
				color: #535353;
				text-decoration: none
			}
			/*添加滑过a标签改变其文字颜色*/
			a:hover {
				color: #D40000;
				text-decoration: none
			}
			
			/* 效果CSS开始 */
	
			/*先让里浮动到一起*/
			.nav li {
				position: relative;
				display: inline-block;
				margin-left: -50px;
				transition: all 0.4s linear;
			}
			/*把a标签画成圆圈*/
			.nav li a {
				display: inline-block;
				width: 90px;
				height: 90px;
				padding: 30px;
				border-radius: 50%;
				border-width: 8px;
				border-style: solid;
			}
			/*滑过li进行放大并把它放到最前面*/
			.nav li:hover {
				z-index: 11;
				transform: scale(1.1);
			}
			
			/*.nav li:hover a {
				text-decoration: none;
			}*/
			
			.nav li:hover span {
				transition: all 0.4s linear;
				animation: moveFromBottom 0.3s ease;
			}
			/*给圆圈加背景色和修改边框颜色*/
			.nav li:nth-child(1) a {
				color: #4d9683;
				text-shadow: 0 1px 0 #9de3cf;
				border-color: #549e89;
				background-color: #51c9a7;
			}
			
			.nav li:nth-child(2) a {
				color: #be607e;
				text-shadow: 0 1px 0 #de8ba5;
				border-color: #e499b0;
				background-color: #e67b9c;
			}
			
			.nav li:nth-child(3) a {
				color: #5e9eb4;
				text-shadow: 0 1px 0 #adddec;
				border-color: #a2cfde;
				background-color: #7ec9e3;
			}
			
			.nav li:nth-child(4) a {
				color: #ba9d5e;
				text-shadow: 0 1px 0 #f5e0ad;
				border-color: #dcc999;
				background-color: #f0cd78;
			}
			
			.nav li:nth-child(5) a {
				color: #b468a2;
				text-shadow: 0 1px 0 #e8acd8;
				border-color: #d8abcd;
				background-color: #dd91cb;
			}
			/*鼠标滑过显示高亮颜色*/
			.nav li:nth-child(1):hover a {
				color: #0f775c;
				text-shadow: 0 1px 0 #81e6c9;
				border-color: #0a8462;
				background-color: #00c18c;
			}
			
			.nav li:nth-child(2):hover a {
				color: #b12a55;
				text-shadow: 0 1px 0 #ff95b7;
				border-color: #ba335c;
				background-color: #ea5180;
			}
			
			.nav li:nth-child(3):hover a {
				color: #2883a2;
				text-shadow: 0 1px 0 #9cdef2;
				border-color: #4397b3;
				background-color: #55c1e5;
			}
			
			.nav li:nth-child(4):hover a {
				color: #ab8228;
				text-shadow: 0 1px 0 #ffe199;
				border-color: #b08f3e;
				background-color: #f8c64d;
			}
			
			.nav li:nth-child(5):hover a {
				color: #a33689;
				text-shadow: 0 1px 0 #ec97d6;
				border-color: #b7569f;
				background-color: #dd70c3;
			}
			
			.nav span {
				display: block;
				line-height: 90px;
				font-size: 30px;
				font-style: normal;
				position: relative; 
				/*width: 100px; 
				height: 90px; */
			}
			/*可以插入一些图片或者小图标,我就不插入了,你们可以自己试试*/
			/*.nav span:before {
			 	display: block;
			 	position: relative; 
			 	margin: auto;
			}
			.nav li:nth-child(1) span:before {
			 	content: "";
			 	width: 0px; 
				height: 0px; 
				border-right: 30px solid transparent; 
				border-top: 30px solid red; 
				border-left: 30px solid red; 
				border-bottom: 30px solid red; 
				border-top-left-radius: 30px; 
				border-top-right-radius: 30px; 
				border-bottom-left-radius: 30px; 
				border-bottom-right-radius: 30px; 
			}*/
			
			@keyframes moveFromBottom {
				from {
					transform: translateY(120%) scale(0.5);
					opacity: 0;
				}
				to {
					transform: translateY(0%) scale(1);
					opacity: 1;
				}
			}

		</style>
	</head>

	<body>
		
		<div class="page">
			<section class="demo">
				<nav class="nav">
					<ul>
						<li>
							<a href=""><span>Home</span></a>
						</li>
						<li>
							<a href=""><span>Phone</span></a>
						</li>
						<li>
							<a href=""><span>Wifi</span></a>
						</li>
						<li>
							<a href=""><span>Setting</span></a>
						</li>
						<li>
							<a href=""><span>Twitter</span></a>
						</li>
					</ul>
				</nav>
			</section>
		</div>
	</body>

</html>

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:

Use css to realize circular progress bar

css, jquery to realize 3D three-dimensional rotation

css implementation Moving cat face

The above is the detailed content of css mouseover animation. For more information, please follow other related articles on the PHP Chinese website!

Statement
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
HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

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

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

The Role of HTML: Structuring Web ContentThe Role of HTML: Structuring Web ContentApr 11, 2025 am 12:12 AM

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTML and Code: A Closer Look at the TerminologyHTML and Code: A Closer Look at the TerminologyApr 10, 2025 am 09:28 AM

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

HTML, CSS, and JavaScript: Essential Tools for Web DevelopersHTML, CSS, and JavaScript: Essential Tools for Web DevelopersApr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

The Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesThe Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesApr 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.

Is HTML easy to learn for beginners?Is HTML easy to learn for beginners?Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

See all articles

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment