In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how the css3 sphere is implemented. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
css3 How to implement a sphere: 1. Create a square element with equal width and height, and set it to a circle using the border-radius attribute;2. Use "background:radial-gradient(...) "statement adds a radially gradient background color to a circular element to achieve a spherical effect.
Operating environment of this tutorial: Windows 7 system, CSS3 && HTML5 version, Dell G3 computer.
css3 Steps to implement a sphere:
1. Basic shape
Let's start with a basic circle, HTML code is as follows:
The new HTML5 tag figure is used here, but other tags can also be used. The figure tag is designed to display images or other graphical content on a web page. To achieve a circular effect, add some basic styles:
.circle {display: block;background: black;border-radius: 50%;height: 300px;width: 300px;margin: 0;}
2. Radial gradient
The basic circular effect is implemented above, and a radial gradient effect is added here to achieve a more realistic sphere.
.circle { display: block; background: black; border-radius: 50%; height: 300px; width: 300px; margin: 0; background: -webkit-radial-gradient(100px 100px, circle, #5cabff, #000); background: -moz-radial-gradient(100px 100px, circle, #5cabff, #000); background: radial-gradient(100px 100px, circle, #5cabff, #000);}
3. Add shadows to enhance the three-dimensional sense
The basic sphere effect is already present in the previous section. To increase the three-dimensional effect, we add a shadow to the bottom of the sphere, so that the three-dimensional effect is stronger.
The HTML code used here is as follows:
CSS code is as follows:
.stage { width: 300px; height: 300px; display: inline-block; margin: 20px; -webkit-perspective: 1200px; -webkit-perspective-origin: 50% 50%; } .circle .shadow { position: absolute; width: 100%; height: 100%; background: -webkit-radial-gradient(50% 50%, circle, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0) 50%); -webkit-transform: rotateX(90deg) translateZ(-150px); z-index: -1; }
CSS is Cascading Style Sheets, a computer language used to represent file styles such as HTML or XML. CSS can not only decorate web pages statically, but also dynamically format elements of web pages with various scripting languages.
Thank you for reading! About "how to realize css3 sphere" this article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.