Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Background making of CSS3 stripes

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly talks about "CSS3 stripe background making". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "CSS3 stripe background making".

Making background background gradient by mozilla Kernel browser

1. Make a simple background with gradual change of stripes.

-browser css style of mozilla kernel:

CSS Code copies content to the clipboard

Body {

Background-color: # aaa

Background-image:-moz-linear-gradient (# 000 25% maxim fc0 80%)

Background-size: 50px 50px

}

Represented by Firefox, the display effect is as follows:

Change the value of background-size to control the height of the background stripes. In the above example, the value of-moz-linear-gradient is divided into two groups, the start value and the end value. At the same time, the start position of the set start value and the end position of the end value form a gradient. The part before the start position is filled with the start color value, and the part after the end value is filled with the end color value.

2. Change the direction of the stripes

CSS Code copies content to the clipboard

Body {

Background-image:-moz-linear-gradient (0degregame 2000 25% meme fc080%)

}

In the above style, a set of parameters are added, the parameters are 0deg-360deg, when this is 0deg, they are vertical stripes, and when the degree increases, they rotate counterclockwise. The following figure shows the time effects of 0deg and 45deg, respectively:

3. We try to add more color gradients.

CSS Code copies content to the clipboard

Body {

Background-image:-moz-linear-gradient (45 degmeng / 25% 25% / 25% fc0 / 80%)

}

As you can see, I added a transparent color (transparent 25%) to the original code. The position of this gradient coincides with that of the previous gradient. What happened to it?

As you can see clearly from the picture above, the first color stops abruptly. Then let's try to add a few more of these colors, what will be the effect? At this point, I'm going to change the angle inside to 0deg, so it will look clearer.

CSS Code copies content to the clipboard

Body {

Background-image:-moz-linear-gradient (0degline / 2000 / 25% / 25 / 50 / 50 / 50 / 75 / 75)

}

Guess what the effect picture will look like?

Here we must pay attention to a problem, which says background-size:50px,50px; so, it can be divided into repeated blocks, each block is 50px*50px, pay attention to the start and end position of each block.

4. The embryonic form of twill background.

Now, what will it look like if we change the original 0deg to 45deg?

You should be able to see that this is already a twill background. Modify it again:

CSS Code copies content to the clipboard

Body {

Background-image:-moz-linear-gradient (45 degmending, 25%, 25%, 50, 50, 50, 50, 000, 50, 000, 75, 75)

Background-size:16px 16px

}

What do you see, whether you get satisfactory results, modify the color value, to achieve your goal. There is also a question, let's think for yourself, what do you need to pay attention to in the value of background-size?

5. Final effect

Although the above twill background has come out, it has not yet achieved the final effect we want. Let's change the color value inside to white. Now the color value is # fff. Let's change it to rgba in rgba form. The first three numbers are rgb and the fourth number is alpha. Now we change the alpha to translucent. The code is as follows:

CSS Code copies content to the clipboard

Body {

Background-color: # eee

Background-image:-moz-linear-gradient (45deg, rgba (255,255,255,0.2) 25%, transparent 25%, transparent 50%, rgba (255,255,255,0.2) 50%, rgba (255,255,255,0.2) 75%, transparent 75%, transparent)

Background-size: 16px 16px

}

Webkit kernel

1. Make a simple vertical stripe background

The css is as follows. The effect image here can be viewed corresponding to the Firefox version above.

CSS Code copies content to the clipboard

Body {

Background-color: # eee

Background-image:-webkit-gradient (linear,0 0100% 0 from (# fff), to (# 000))

Background-size: 80px 80px

}

2. Change the direction of the stripes

CSS Code copies content to the clipboard

Body {

Background-image:-webkit-gradient (linear,0 100% focus 100% from # fff, to (# 000))

}

3. Add rich color gradient

CSS Code copies content to the clipboard

Body {

Background-image:-webkit-gradient (linear,0 0100% 0 fff from (# fff), to (# 000), color-stop (25% recorder fc0), color-stop (50% meme 0fc), color-stop (75% meme f0c)

}

4. Adjust the color and add a transparent color.

The code is as follows:

Background-image:-webkit-gradient (linear,0 0100% 0quotient color stop (25% recorder 0FC), color-stop (25% recorder), color-stop (50% recorder), color-stop (50% recorder fc0), color-stop (75% recorder f0c), color-stop (75% pencil)

5. Adjust the direction according to step 2

The code is as follows:

Background-image:-webkit-gradient (linear,0 100% telegram 100% 0Colour stop (25% recorder 0FC), color-stop (25% recorder 0FC), color-stop (50% recorder), color-stop (50% recorder fc0), color-stop (75% recorder f0c), color-stop (75% pencil)

6. Adjust the color and background-size size

CSS Code copies content to the clipboard

Body {

Background-image:-webkit-gradient (linear,0 100% focus 100% Colorus stop (25%), color-stop (25%), color-stop (50%), color-stop (50%), color-stop (75%), color-stop (75%))

Background-size: 16px 16px

}

7. Adjust the transparency of color values, and the final effect is as follows:

Although the above twill background has come out, it has not yet achieved the final effect we want. Let's change the color value inside to white. Now the color value is # fff. Let's change it to rgba in rgba form. The first three digits are rgb, and the fourth number is alpha. Now we change the alpha to translucent. The final code is as follows:

CSS Code copies content to the clipboard

Body {

Background-color: # eee

Background-image:-moz-linear-gradient (45degjifff 25%, transparent 25%, transparent 50% precinct 50% transparent 75%, transparent 75%, transparent)

Background-image:-webkit-gradient (linear,0 100% meme 100% 0 0Colour stop), color-stop (25% recorder), color-stop (50% temperament), color-stop (50% recorder RGBA (255pr RGBA), color-stop (75% meme RGBA (255pm 255rgba), color-stop (75% temperance)

Background-size: 16px 16px

}

At this point, I believe you have a deeper understanding of the "CSS3 stripe background production", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report