Web development technology is being innovated every year. browsers have gradually supported the CSS3 feature, and website designers and front-end developers generally adopt this new technology for design and development. But some developers are still obsessed with some CSS2 code.
This article will share 20 very professional CSS2/CSS3 codes for your use. You can save them in the IDE or in the CSS document, these code snippets will definitely surprise you.
1. CSS Resets
There are a lot of code on the network for CSS resetting. This code is adapted based on Eric Meyer's reset codes. It contains a response-style image and the boundary setting of all core elements, in this way, the margins and padding can be well aligned.
{:;:;:;:;:;:;:;:;:;:;}{:; }{:;:;:; }{:; }{:; }{:; }{:;:; }{:; }{:;:; }{:;:; }{:;:;:; }
2. Classic CSS Clearfix
This clearfix code has been widely used among Web developers. This class selector should be applied to containers with floating elements to ensure that the subsequent content is not floating, but will be pushed down and cleared.
{:;:;:;:;:;:; }{:; }{:; }{:; }
3. Upgraded Clearfix
In terms of performance, there is no difference between the new version and the classic version. These classes can effectively clear all floats, but they are only compatible with modern browsers and traditional IE 6-8.
{:;:; }{:; }{:; }
4. Cross-Browser Transparency
Many Attributes in CSS3 are compatible with browsers, but there are also special cases, such as opacity, which must be updated. The additional filter attribute can be compatible with any old version of Internet Explorer.
{:;:; :; :; }
Source Code address: http://perishablepress.com/cross-browser-transparency-via-css/
5. CSS Blockquote Template
This code is mainly used to separate reference or copy content on the page, and provides the default style for the page text.
{:;:;:;:;:;}{:;:;:;:;:;:;}{:;}
View Source Code: http://css-tricks.com/snippets/css/simple-and-nice-blockquote-styling/
6. Personalized rounded corner code
Many CSS developers are familiar with the rounded corner syntax, but how do I set different values for each corner? Let's take a look at the following code!
{:;:;:;:;}{:;:;:;:;:;:;:;:;}
7. General media Query
This is a very good template for various fragmented media queries and can also be used on mobile devices. This code can even be referenced to the retina device by using min-device-pixel-ratio.
{ } { } { }{ }{ }{ } { }{ }{ }
Source Code address: http://css-tricks.com/snippets/css/media-queries-for-standard-devices/
8. Modern font Stack
It is still difficult to design your own font stack on the new web page. I hope the following code will inspire you and Develop templates. For more information about the font stack source code, you can access CSS Font Stacks.
Source Code address: http://www.sitepoint.com/eight-definitive-font-stacks/
9. Select custom text
Some new Web browsers allow you to customize some highlighted colors on the Web page. The default color of the following code is light blue. Of course, you can set various colors based on your personal interests. The following code references a typical Webkit and Mozilla vendor Prefix: selection.
{:; }{:; }{:; }
10. Hide the H1 text on the Logo
{:;:;:;:;:;}
11. Create a Paster effect border for the image
The following code allows you to create a photo with a large white border and a tiny shadow. You need to modify the image width/height to match your website layout.
{:;:;:;:;:;}
Source Code address: http://www.smipple.net/snippet/kettultim/Polaroid%20Image%20Border%20-%20CSS3
12. Pseudo-class selector of the anchor Link
{:; }{:; }{:; }{:; }
13. Fancy CSS3 Pull-Quotes
Pull-quotes is different from blockquote in pages. They are usually used to reference text in articles.
{ :;:; :; :;:;:; :;:; :;:;}{:;:;:;}{:;:;:;}{:;:;:;}
14. full screen background Effects of CSS3
If you want to use a large image as the background of a website and want to keep it fixed during Page scrolling, this code snippet is very suitable, but this Code cannot work on the old browser.
{:;:;:;:;:;}
15. Content vertical concentration
It is difficult to control the content in the vertical direction relative to the content in the horizontal position, especially when the scroll bar is taken into account. This pure CSS code can work well.
{:;:;:;}
16. vertical scroll bar
{:}
17. CSS3 Gradients Template
{:;:;:;:;:;:;:;}
18. @ Font-Face template
Use @ font-face to embed the TTF/OTF/SVG/WOFF file into the website and generate a Custom font families.
{:;:;:;}{:;}
19. Create a stitching Effect
{:;:;:;:;:;:;:;:;:;:;:;:;:;:;}{:;:;:;:;:;:;:;:;}{:;:;}{:;}
20. CSS3 zebra Effect
{:;}