


CSS3 practical development: teach you step by step how to develop the corner effect_html/css_WEB-ITnose
Dear netizens, hello everyone, I am The Flower Will Bloom on Moshang. In today’s article, I will teach you step by step how to develop a set of pure CSS folding effect. As always, I do not provide code downloads, but I can guarantee that as long as you copy the code in the tutorial to your local computer, you will definitely get the same effect as I demonstrated. I hope you understand my intention.
Okay, let’s start today’s tutorial directly. First of all, let me show you the effect of today’s practical case:
Some people will say what is this? This is our actual development today. I will lead you to develop the folding effect in the upper right corner in the picture above.
Before I finish explaining, some people may find it difficult and incredible. I want to tell you: it’s really so easy. Please follow my breakdown below and learn step by step!
First, we create a blue area with the following code:
<!DOCTYPE html><html><head><meta charset="utf-9"><meta name="keywords" content="css,css3,实战互联网,教程"><meta name="description" content="css3实现折角效果,折角效果,css3实战尽在实战互联网" ><link rel="stylesheet" href="styles_2014080901.css"><title>CSS3实现折角效果实战开发</title></head><body><div class="note"></div></body></html>
接着我们给.note元素应用样式:
*{ /*清除所有元素的内外边距*/margin:0;padding:0;}.note { /*设置折叠样式基本属性*/width:480px;height:400px;margin:2em auto; /*调整.note元素的外边距*/padding:2em;background:#53A3B4;}
Now Let’s take a look at the running effect at this time:
How to achieve this folding effect? Please pay attention to my following steps.
I now use the pseudo element of CSS3 to insert a piece of content into the page. " "; Since pseudo-elements are inline elements by default, if you want to set the width and height, you must explicitly set it to block. If you have more detailed information about relative pseudo-elements, please pay attention to my space.
The pseudo element is created, but I want the element I created to be in the upper right corner of the .note area. Well, we can adjust the position of the element through position's relative (relative positioning) and absolute (absolute positioning).
.note:before {content:"";display:block; /*伪元素默认是行内元素,所以如果要设定宽高,这必须显性设置为block*/border-width:0 16px 16px 0; /*设置边框宽度*/border-color:#fff #fff transparent transparent; background:transparent;border-style:solid; /*设置边框为固体的*/width:0; /*设定新创建的元素*/}
Then use the absolute positioning attribute to make our newly created The object is located in the upper right corner of the container:
.note { /*设置折叠样式基本属性*/width:480px;height:400px;margin:2em auto; /*调整.note元素的外边距*/padding:2em;background:#53A3B4;<strong> position:relative;</strong>}
At this point, let’s take a look at the effect:
Great, the missing corner has been realized . We said at the beginning that the folded corners have a shadow effect. Now let’s add a shadow style to .note:before:
.note:before {content:"";display:block; /*伪元素默认是行内元素,所以如果要设定宽高,这必须显性设置为block*/border-width:0 16px 16px 0; /*设置边框宽度*/border-color:#fff #fff transparent transparent; background:transparent;border-style:solid; /*设置边框为固体的*/width:0; /*设定新创建的元素*/ position:absolute; /*相对于父容器绝对定位,设置偏移父容器边框距离*/ top:0; right:0;}
Now let’s take a look at the effect after adding the shadow style:
/*设置元素的阴影效果*/-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.3), -1px 1px 1px rgba(0,0,0,0.2);-moz-box-shadow:0 1px 1px rgba(0,0,0,0.3), -1px 1px 1px rgba(0,0,0,0.2);box-shadow:0 1px 1px rgba(0,0,0,0.3), -1px 1px 1px rgba(0,0,0,0.2);
At this point, you’re done. It turns out that it’s so simple to use pure CSS3 to achieve the folding effect.
Because it is for display, I set a fixed height. If you want to make it flexible, you can cancel its attribute.
For more practical tutorials, please continue to pay attention to my space. Thank you for reading.
Welcome to join the Internet technology exchange group: 62329335
Personal statement: The blog posts shared are absolutely original, and we strive to make every one of them original. Knowledge points are verified through practical demonstrations.

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

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











You may have encountered the problem of green lines appearing on the screen of your smartphone. Even if you have never seen it, you must have seen related pictures on the Internet. So, have you ever encountered a situation where the smart watch screen turns white? On April 2, CNMO learned from foreign media that a Reddit user shared a picture on the social platform, showing the screen of the Samsung Watch series smart watches turning white. The user wrote: "I was charging when I left, and when I came back, it was like this. I tried to restart, but the screen was still like this during the restart process." Samsung Watch smart watch screen turned white. The Reddit user did not specify the smart watch. Specific model. However, judging from the picture, it should be Samsung Watch5. Previously, another Reddit user also reported

This AI-assisted programming tool has unearthed a large number of useful AI-assisted programming tools in this stage of rapid AI development. AI-assisted programming tools can improve development efficiency, improve code quality, and reduce bug rates. They are important assistants in the modern software development process. Today Dayao will share with you 4 AI-assisted programming tools (and all support C# language). I hope it will be helpful to everyone. https://github.com/YSGStudyHards/DotNetGuide1.GitHubCopilotGitHubCopilot is an AI coding assistant that helps you write code faster and with less effort, so you can focus more on problem solving and collaboration. Git

Speaking of ASSASSIN, I believe players will definitely think of the master assassins in "Assassin's Creed". They are not only skilled, but also have the creed of "devoting themselves to the darkness and serving the light". The ASSASSIN series of flagship air-cooled radiators from the appliance brand DeepCool coincide with each other. Recently, the latest product of this series, ASSASSIN4S, has been launched. "Assassin in Suit, Advanced" brings a new air-cooling experience to advanced players. The appearance is full of details. The Assassin 4S radiator adopts a double tower structure + a single fan built-in design. The outside is covered with a cube-shaped fairing, which has a strong overall sense. It is available in white and black colors to meet different colors. Tie

A large model that can automatically analyze the content of PDFs, web pages, posters, and Excel charts is not too convenient for workers. The InternLM-XComposer2-4KHD (abbreviated as IXC2-4KHD) model proposed by Shanghai AILab, the Chinese University of Hong Kong and other research institutions makes this a reality. Compared with other multi-modal large models that have a resolution limit of no more than 1500x1500, this work increases the maximum input image of multi-modal large models to more than 4K (3840x1600) resolution, and supports any aspect ratio and 336 pixels to 4K Dynamic resolution changes. Three days after its release, the model topped the HuggingFace visual question answering model popularity list. Easy to handle

With its compact size, the ITX platform has attracted many players who pursue the ultimate and unique beauty. With the improvement of manufacturing processes and technological advancements, both Intel's 14th generation Core and RTX40 series graphics cards can exert their strength on the ITX platform, and gamers also There are higher requirements for SFX power supply. Game enthusiast Huntkey has launched a new MX series power supply. In the ITX platform that meets high-performance requirements, the MX750P full-module power supply has a rated power of up to 750W and has passed 80PLUS platinum level certification. Below we bring the evaluation of this power supply. Huntkey MX750P full-module power supply adopts a simple and fashionable design concept. There are two black and white models for players to choose from. Both use matte surface treatment and have a good texture with silver gray and red fonts.

On March 3, 2022, less than a month after the birth of the world's first AI programmer Devin, the NLP team of Princeton University developed an open source AI programmer SWE-agent. It leverages the GPT-4 model to automatically resolve issues in GitHub repositories. SWE-agent's performance on the SWE-bench test set is similar to Devin, taking an average of 93 seconds and solving 12.29% of the problems. By interacting with a dedicated terminal, SWE-agent can open and search file contents, use automatic syntax checking, edit specific lines, and write and execute tests. (Note: The above content is a slight adjustment of the original content, but the key information in the original text is retained and does not exceed the specified word limit.) SWE-A

Go language development mobile application tutorial As the mobile application market continues to boom, more and more developers are beginning to explore how to use Go language to develop mobile applications. As a simple and efficient programming language, Go language has also shown strong potential in mobile application development. This article will introduce in detail how to use Go language to develop mobile applications, and attach specific code examples to help readers get started quickly and start developing their own mobile applications. 1. Preparation Before starting, we need to prepare the development environment and tools. head

With the arrival of spring, everything revives and everything is full of vitality and vitality. In this beautiful season, how to add a touch of color to your home life? Haqu H2 projector, with its exquisite design and super cost-effectiveness, has become an indispensable beauty in this spring. This H2 projector is compact yet stylish. Whether placed on the TV cabinet in the living room or next to the bedside table in the bedroom, it can become a beautiful landscape. Its body is made of milky white matte texture. This design not only makes the projector look more advanced, but also increases the comfort of the touch. The beige leather-like material adds a touch of warmth and elegance to the overall appearance. This combination of colors and materials not only conforms to the aesthetic trend of modern homes, but also can be integrated into
