Home Web Front-end CSS Tutorial Front-end development CSS3 technology experience sharing

Front-end development CSS3 technology experience sharing

Sep 21, 2018 pm 03:02 PM
css3

Recently, I have summarized some knowledge of the front-end to facilitate my own review in the future, and also share it with everyone, hoping that everyone will avoid detours. This article mainly summarizes the relevant knowledge in CSS3. Friends in need can refer to it. I hope it will be useful to you.

1. Set font (compatible with all browsers)

1

2

3

4

5

6

7

8

9

10

@font-face {

font-family: 'iconfont';

src: url("fonts/iconfont/iconfont.eot");

src: url("fonts/iconfont/iconfont.eot?#iefix") format("embedded-opentype"),

url("fonts/iconfont/iconfont.ttf") format("truetype"),

url("fonts/iconfont/iconfont.woff") format("woff"),

 url("fonts/iconfont/iconfont.svg#icomoon") format("svg");

font-weight: normal;

font-style: normal; }

@font-face { font-family : name ; src : url( url ) ; sRules }

Copy after login

Description:

name: Font name

url: Use absolute or relative addresses to specify OpenType fonts

sRules: Style sheet definitions

Set the fonts embedded in HTML documents.

@font-face { font-family: dreamy; font-weight: bold; src: url(http://www.example.com/font.eot); }

2. div[class^="test"]

Set the background color of all div elements whose class attribute value starts with "test" within the div:

1

2

3

4

div[class^="test"]

{

background:#ffff00;

}

Copy after login

3. [class*="abc"]

The value of class contains elements of "abc".

1

div[class*="abc"]

Copy after login

represents only the style with class=abc in the div

4. Specify the background style of the last p tag

1

p:last-child{ background:#ff0000;}

Copy after login

5. Display When the device resolution is minimum 768 and maximum 979, abc (CSS3) is displayed

1

2

3

@media (min-width: 768px) and (max-width: 979px) {

.abc{}

}

Copy after login

ie6-ie9 supports

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

<style>

@media screen and (min-width: 1201px) {

.y-row {

width: 1200px;

border:1px solid #333; height:300px;

min-width: 1200px; } }

@media screen and (max-width: 1200px) {

.y-row {

width: 900px;

border:1px solid #333; height:300px;

min-width: 900px; } }

</style>

<!--[if lt IE 9]>

<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>

<![endif]-->

Copy after login

6, div > span (not supported by IE6)

div > span{font 12px}

The son span style within the div tag is font 12px, and the grandson span within the div does not work and has priority

7. Font shadow

.blue { background:#01dbff; text-shadow:2px 2px 2px #09a5ef; }

Shadow font left distance bottom distance shadow distance Range shadow color

Font background font shadow

8, box shadow

-moz-border-radius:0px 5px 5px 0px; -webkit- border-radius:0px 5px 5px 0px; border-radius:0px 5px 5px 0px; -moz-box-shadow:0px 0px 1px #fff inset; -webkit-box-shadow:0px 0px 1px #fff inset; box-shadow: 0px 0px 1px #fff inset;

-moz represents the private properties of the firefox browser

-ms represents the private properties of the IE browser

-webkit represents the private properties of chrome and safari

-o represents opera Apple browser

Settings

border-radius:0px 5px 5px 0px; means the upper right and lower right rounded corners of the border are 5px

box-shadow:0px 0px 1px #fff inset; means the border spacing is 0 to the left, 0 to the top and 1px. The shadow range is white.

With inset, it means the shadow inside the box. Without inset, it means the shadow outside the box.

Note: box-shadow:0px 0px 1px #fff

When the first value is 0, it means that the shadow of the left and right borders is 1px range

The first value is a positive integer, which means the left Border shadow

The first value is a negative integer representing the shadow of the right border

Similarly

The second value is 0 representing the shadow of the upper and lower borders

The two positive integers represent the distance of the 1px shadow from the upper border.

The first value is a negative integer and represents the bottom border shadow setting.

border-radius rounded corners

9, :first-letter

p:first-letter{font-size:20px}

means that the size of the first word in the p tag is 20px

10. div:first-line { color:red;font-size:16px; }

means the first line of text in the DIV is red and the font is 16px

11, p a:first-child { color: green }

represents the first a hyperlink in the p box, the font color is green

12, p :before { content: "I am here" }

represents adding a piece of content before the p tag object: "I am here"

13. table:after { content : END OF TABLE }

means displaying the content "END OF TABLE" after the table object.

14. Single colon and double colon

Pseudo element consists of double colon and pseudo element name. The double colon was introduced in the current specification to distinguish pseudo-classes from pseudo-elements. However, pseudo-classes are compatible with existing styles, and browsers need to support old pseudo-classes at the same time, such as :first-line, :first-letter, :before, :after, etc.

Now you can fully answer the question in the title. For the pseudo-elements that existed before CSS2, such as :before, the single colon and the double colon::before have the same effect.

So, if your website only needs to be compatible with webkit, firefox, opera and other browsers, it is recommended to use double colon writing method for pseudo elements. If it has to be compatible with IE browser, it is better to use CSS2 single colon writing method. Safety.

15. .uploader input[type=file]{}

means that the class is uploader and the input label attribute in the box is set to type=file.

The above is the detailed content of Front-end development CSS3 technology experience sharing. For more information, please follow other related articles on the PHP Chinese website!

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

Video Face Swap

Video Face Swap

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

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)

How to achieve wave effect with pure CSS3? (code example) How to achieve wave effect with pure CSS3? (code example) Jun 28, 2022 pm 01:39 PM

How to achieve wave effect with pure CSS3? This article will introduce to you how to use SVG and CSS animation to create wave effects. I hope it will be helpful to you!

Use CSS skillfully to realize various strange-shaped buttons (with code) Use CSS skillfully to realize various strange-shaped buttons (with code) Jul 19, 2022 am 11:28 AM

This article will show you how to use CSS to easily realize various weird-shaped buttons that appear frequently. I hope it will be helpful to you!

How to hide elements in css without taking up space How to hide elements in css without taking up space Jun 01, 2022 pm 07:15 PM

Two methods: 1. Using the display attribute, just add the "display:none;" style to the element. 2. Use the position and top attributes to set the absolute positioning of the element to hide the element. Just add the "position:absolute;top:-9999px;" style to the element.

How to implement lace borders in css3 How to implement lace borders in css3 Sep 16, 2022 pm 07:11 PM

In CSS, you can use the border-image attribute to achieve a lace border. The border-image attribute can use images to create borders, that is, add a background image to the border. You only need to specify the background image as a lace style; the syntax "border-image: url (image path) offsets the image border width inward. Whether outset is repeated;".

How to enlarge the image by clicking the mouse in css3 How to enlarge the image by clicking the mouse in css3 Apr 25, 2022 pm 04:52 PM

Implementation method: 1. Use the ":active" selector to select the state of the mouse click on the picture; 2. Use the transform attribute and scale() function to achieve the picture magnification effect, the syntax "img:active {transform: scale(x-axis magnification, y Axis magnification);}".

It turns out that text carousel and image carousel can also be realized using pure CSS! It turns out that text carousel and image carousel can also be realized using pure CSS! Jun 10, 2022 pm 01:00 PM

How to create text carousel and image carousel? The first thing everyone thinks of is whether to use js. In fact, text carousel and image carousel can also be realized using pure CSS. Let’s take a look at the implementation method. I hope it will be helpful to everyone!

How to set animation rotation speed in css3 How to set animation rotation speed in css3 Apr 28, 2022 pm 04:32 PM

In CSS3, you can use the "animation-timing-function" attribute to set the animation rotation speed. This attribute is used to specify how the animation will complete a cycle and set the speed curve of the animation. The syntax is "element {animation-timing-function: speed attribute value;}".

Does css3 animation effect have deformation? Does css3 animation effect have deformation? Apr 28, 2022 pm 02:20 PM

The animation effect in css3 has deformation; you can use "animation: animation attribute @keyframes ..{..{transform: transformation attribute}}" to achieve deformation animation effect. The animation attribute is used to set the animation style, and the transform attribute is used to set the deformation style. .

See all articles