Home Web Front-end HTML Tutorial 纯css实现扁平化360卫士logo demo_html/css_WEB-ITnose

纯css实现扁平化360卫士logo demo_html/css_WEB-ITnose

Jun 24, 2016 am 11:27 AM

前几天在w3ctech上看到有人用纯css写出了360卫士的logo,感觉蛮好玩的。

 

因为自己用css以来,还没有写过这种玩意,出于娱乐,我也来试着尝试一下。

 

开始也不知到怎么下手,最棘手的是那两个像太极的东东不好弄。不过,好在以前用过photoshop绘制过一些简单的icon。所以,经过我仔细

 

的分析。大概有了思路,这两个东东是可以利用box-shadow这个属性来实现。虽然跟photoshop绘制有点不同,但是大致还是差不多的。

 

代码效果预览地址:http://code.w3ctech.com/detail/2501。

 1 <div class="container"> 2         <div class="content top"></div> 3         <div class="content bottom"></div> 4         <div class="content center"> 5             <div class="line x"></div> 6             <div class="line y"></div> 7         </div> 8         <div class="clip"></div> 9         <div class="circle circle-top"></div>10         <div class="circle circle-bottom"></div>11         <div class="react-top"></div>12         <div class="react-bottom"></div>13     </div>
Copy after login

在html代码部分,其实是有赘余的。像react-top 和 react-bottom这两个部分是可以不用的。由于自己没有通过比例计算。所以,

只好用这两个东东打补丁了。

  1 * {  2             padding: 0;  3             margin: 0;  4         }  5   6         body {  7             background-color: #d5d3d4;  8         }  9  10         .container { 11             width: 450px; 12             height: 450px; 13             position: relative; 14             top: 100px; 15             left: 50%; 16             transform: translateX(-50%); 17             background-color: #fff; 18             border-radius: 10px; 19             box-shadow: 0 0 5px #c2bfbf; 20         } 21  22         .content { 23             width: 300px; 24             height: 300px; 25             border-radius: 50%; 26             position: absolute; 27         } 28         .top{ 29             top: 55px; 30             left: 100px; 31             box-shadow:0 30px 0 #50dd45; 32             transform:rotate(50deg); 33             z-index:1000; 34         } 35         .center{ 36             top: 75px; 37             left: 75px; 38             background-color: #e8fc38; 39  40         } 41         .bottom{ 42             top: 95px; 43             left: 50px; 44             box-shadow:0 -30px 0 #50dd45; 45             transform:rotate(50deg); 46             z-index:1000; 47         } 48         .clip{ 49             width:1px; 50             height:1px; 51             border:150px solid transparent; 52             border-left-color:#e8fc38; 53             border-right-color:#e8fc38; 54             border-radius:50%; 55             position:absolute; 56             top:50%; 57             left:50%; 58             transform:translate(-50%,-50%); 59             z-index:1001; 60         } 61         .line{ 62             background-color:#50dd45; 63             border-radius:20px; 64             position:absolute; 65             top:50%; 66             left:50%; 67             transform:translate(-50%,-50%); 68             z-index:1010; 69         } 70         .x{ 71             width:180px; 72             height:45px; 73         } 74         .y{ 75             width:45px; 76             height:180px; 77         } 78         .circle{  79             width: 30px; 80             height: 32px; 81             border-radius: 50%; 82             background-color: #50dd45; 83             z-index: 1012; 84         } 85         .circle-bottom{ 86             position: absolute; 87             top: 302px; 88             left: 114px; 89         } 90         .circle-top{ 91             position:absolute; 92             top: 111px; 93             left: 300px; 94         } 95         .react-top{ 96             width: 15px; 97             height: 8px; 98             background-color: #e8fc38; 99             transform: rotate(150deg);100             position: absolute;101             top: 115px;102             left: 120px;103             z-index: 1100;104         }105         .react-bottom{106             width: 15px;107             height: 8px;108             background-color: #e8fc38;109             transform: rotate(150deg);110             position: absolute;111             top: 326px;112             left: 317px;113             z-index: 1100;114         }
Copy after login

由于自己比较喜欢用firefox的开发者工具,所以这个只在firefox上测试过。

 

对于刚在学习css的同学是个不错的小案例,分享给你们,有兴趣的可以试试。当然,如果有更好的思路的,可以在下面留言,相互探讨,一起进步。

 

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

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)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

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)

What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

The article discusses the HTML &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

The article discusses the HTML &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

The article discusses the HTML &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

What is the viewport meta tag? Why is it important for responsive design? What is the viewport meta tag? Why is it important for responsive design? Mar 20, 2025 pm 05:56 PM

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

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.

What is the purpose of the <iframe> tag? What are the security considerations when using it? What is the purpose of the <iframe> tag? What are the security considerations when using it? Mar 20, 2025 pm 06:05 PM

The article discusses the &lt;iframe&gt; tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

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.

What is an example of a starting tag in HTML? What is an example of a starting tag in HTML? Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

See all articles