css3实现的动态月食效果代码实例:
本章节分享一段代码实例,它利用CSS3实现了动态的月食效果。
动画其实比较简单简短,需要的朋友可以自行做一下分析,这里就不多介绍了。
代码实例如下:
<!DOCTYPE html><html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.softwhy.com/" /> <title>蚂蚁部落</title> <style type="text/css">*{ margin:0; padding:0;}body{ background-color: #000;}.moonback{ width:600px; height:600px; background-color:#000; margin:0 auto; position: relative;}.moonback::before{ content:","; display:block; position:absolute; left:200px; top:100px; width:200px; height:200px; background-color:#ff0; border-radius:100px;}.moonback::after{ content:" "; display:block; position:absolute; left:26px; top:0px; width:200px; height:200px; background-color:#000; border-radius:100px; -webkit-animation:12s dog linear infinite; -moz-animation:12s dog linear infinite; animation:12s dog linear infinite; -webkit-animation-fill-mode:forwards; -moz-animation-fill-mode: forwards; animation-fill-mode: forwards;} @-webkit-keyframes dog{ 0%{ left:27px; top:0px; } 100%{ left:399px; top:216px; }}@-moz-keyframes dog { 0%{ left:27px; top:0px; } 100%{ left:399px; top:216px; }}@keyframes dog{ 0%{ left:27px; top:0px; } 100%{ left:399px; top:216px; }}.star{ position:absolute;}.star::before{ content:"★"; display:block; position:absolute; left:10px; top:20px; width:auto; height:auto; color:#fff; -webkit-transform:scale(0.5); -moz-transform:scale(0.5); transform:scale(0.5); -webkit-animation:1s starlight linear infinite; -moz-animation:1s starlight linear infinite; animation:1s starlight linear infinite; -webkit-animation-fill-mode:forwards; -moz-animation-fill-mode: forwards; animation-fill-mode: forwards;}.star::after{ content:"★"; display:block; position:absolute; left:40px; top:120px; width:auto; height:auto; color:#fff; -webkit-transform:scale(0.5); -moz-transform:scale(0.5); transform:scale(0.5); -webkit-animation:2s starlight linear infinite; -moz-animation: 2s starlight linear infinite; animation: 2s starlight linear infinite;} @-webkit-keyframes starlight{ 0%{ -webkit-transform:scale(0.5); } 100%{ -webkit-transform:scale(0.1); }}@-moz-keyframes starlight{ 0%{ -moz-transform:scale(0.5); } 100%{ -moz-transform:scale(0.1); }}@keyframes starlight{ 0%{ transform:scale(0.5); } 100%{ transform:scale(0.1); }} </style> </head> <body> <div class="content"> <div class="moonback"> <div class="star" style="top:20px;right:220px;"></div> <div class="star" style="top:50px;right:120px;"></div> <div class="star" style="top:190px;left:20px;"></div> <div class="star" style="top:220px;left:50px;"></div> </div> </div> </body></html>
上面的代码实现了我们的要求,更多内容可以参阅相关阅读。
相关阅读:
(1).::before可以参阅CSS的伪对象选择符before/E::before一章节。
(2).border-radius可以参阅CSS3实现圆角效果一章节。
(3).animation可以参阅CSS3的animation属性用法详解一章节。
(4).animation-fill-mode可以参阅animation-fill-mode一章节。
原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=18153
更多内容可以参阅:http://www.softwhy.com/divcss/

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

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.

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.

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

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.

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


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver Mac version
Visual web development tools