Home >Web Front-end >HTML Tutorial >Proficient in the use of CSS DIV web page styles and layout filters_html/css_WEB-ITnose
In the last blog, the editor briefly introduced the use of CSS and how to create practical menus. Today we continue to summarize the basic knowledge about CSS. Today the editor briefly introduces the basics of CSS. The use of filters. First of all, the editor will briefly introduce filters. This time we will talk about the use of filters. First of all, the editor will briefly introduce the concept of filters. CSS filters are not browsers. The plug-ins do not comply with CSS standards. Secondly, they are a collection of tired functions specially developed by Microsoft to enhance browser functions and integrated into IE browser. Since the browser IE has a wide range of uses, CSS filters are also loved by designers. The logo of the CSS filter is "Filter". Generally, it is very simple as other CSS statements. Then, let's take a look at a mind map:
Then, Xiaobian Following the context of the above mind map, let’s briefly introduce it in turn. First, let’s take a look at the Alpha channel. Let’s look at the example code and running effects:
Alpha channel
<span style="font-size:18px;"><span style="font-size:18px;"><html><head><title>alpha滤镜</title><style><!--body{ background:url(bg1.jpg); margin:20px;}img{ border:1px solid #d58000;}.alpha{ filter:alpha(opacity=50);}--></style> </head><body><img src="building1.jpg" border="0"> <img src="building1.jpg" border="0" class="alpha"></body></html></span></span>
The running effect is as follows:
The effect is even stronger. Let's look at the CSS code: here we put filter:alpha(opacity=20); of course, you can set different values yourself to see the display effect. Let's look at blur next. We can create a blurry effect without using photoshop. Let’s take a look at the example code and the running effect:
Blur blur
The running effect is as follows:
<span style="font-size:18px;"><span style="font-size:18px;"><html><head><title>Blur滤镜</title><style><!--body{ margin:10px;}.blur{ filter:progid:DXImageTransform.Microsoft.blur(pixelradius=4,makeshadow=false);}--></style> </head><body><img src="building9.jpg"> <img src="building9.jpg" class="blur"></body></html></span></span>
Let’s analyze the above example and compare the two pictures. The second picture uses class="blur". We see this sentence filter:progid:DXImageTransform.Microsoft.blur(pixelradius=4,makeshadow=false ); Here we set the blur effect
pixelradius to different values, and you can see different blur effects. You can try it yourself. Let's look at the transparent color filter next. Let's look at the example code and running effect:
The running effect is as follows:
<span style="font-size:18px;"><span style="font-size:18px;"><html><head><title>chroma滤镜</title><style><!--body{ margin:10px;}.chroma{ filter:chroma(color=FF6800); /* 去掉金黄色 */}--></style> </head><body> <img src="tiger.gif"> <img src="tiger.gif" class="chroma"></body></html></span></span>
Analyze the above examples, we clearly see that the golden yellow on the tiger is filtered. We read this sentence: Filter: chroma (color = ff6800); Remove the yellow color. Let’s continue looking at the flip filter. CSS can flip the image without processing the image. See the example code and running effect below:
<span style="font-size:18px;"><span style="font-size:18px;"><html><head><title>Flip翻转</title><style><!--body{ margin:12px; background:#000000;}.flip1{ filter:fliph; /* 水平翻转 */}.flip2{ filter:flipv; /* 竖直翻转 */}.flip3{ filter:flipv fliph; /* 水平、竖直同时翻转 */}--></style> </head><body><img src="building4.jpg"><img src="building4.jpg" class="flip1"><br><img src="building4.jpg" class="flip2"><img src="building4.jpg" class="flip3"></body></html></span></span>
The running effect is as follows:
Analyze the above example. Here are actually four pictures. The first one (upper left corner) is the original film; the second picture is processed. The horizontal image is mirrored vertically in the third one; while the lower right corner is mirrored both horizontally and vertically. Let's take a look at the code: We can also see from the code that flip1 has been flipped horizontally. Let's continue to look at the mask. Photoshop has a powerful mask function. Let's look at the example code and running effect:
<span style="font-size:18px;"><html><head><title>Mask遮罩</title><style><!--body{ margin:12px; background:#000000;}.mask{ filter:mask(color=#FF0000); /* 遮罩效果 */}--></style> </head><body> <img src="muma.gif"> <img src="muma.gif" class="mask"></body></html></span>
Analyzing the above example, we see that the second picture is a bit like a shadow changing effect. Let's take a look at the CSS code. In our code, the first picture is not processed, and the second picture is masked. . Let’s look at this sentence: filter:mask(color=RED); This is the color that needs to be masked. Let’s continue to look at the best filter, the wave filter. We often use photoshop to achieve the wave effect. CSS can also be used. Let’s take a look at the example code and running effect:
The running effect is as follows :
<span style="font-size:18px;"><html><head><title>Wave波浪滤镜</title><style><!--body{ margin:12px; background-color:#e4f1ff;}span{ font-family:Arial, Helvetica, sans-serif; height:100px; font-size:80px; font-weight:bold; color:#50a6ff;}span.wave1{ filter:wave(add=0,freq=2,lightstrength=70,phase=75,strength=4);}span.wave2{ filter:wave(add=0,freq=4,lightstrength=20,phase=25,strength=5);}span.wave3{ filter:wave(add=1,freq=4,lightstrength=60,phase=0,strength=6);}--></style> </head><body> <span class="wave1">波浪Wave</span> <span class="wave2">波浪Wave</span> <span class="wave3">波浪Wave</span></body></html></span>
Analyze the above example. Each of the three paragraphs of text here uses a wave effect:
(add=0,freq=2, lightstrength=70, phase=75, strength=4), the expressed frequency is 2, and the final degree is 4. Finally, let’s look at a comprehensive example. What kind of magical effect will there be when three filters are used together? Example The code and running effect are as follows:
The running effect is as follows:
<span style="font-size:18px;"><html><head><title>三个滤镜同时使用</title><style><!--body{ margin:12px; background:#000000;}.three{ filter:flipv alpha(opacity=80) wave(add=0, freq=15, lightstrength=30, phase=0, strength=4); /* 同时使用三个滤镜 */ /* 竖直翻转、透明、波浪效果 */}--></style> </head><body> <img src="lotus.jpg"><br> <img src="lotus.jpg" class="three"></body></html></span>
Message from the editor: In this blog post, the editor briefly introduces the relevant knowledge points about filters in CSS, including Alpha channel, Blur, transparent color, etc., the last one A small example, three filters are used at the same time. If you want to make the effect more beautiful and colorful, the editor still recommends using Photoshop. After all, the display effects of these small examples are different in various browsers. BS learning, To be continued...