Home  >  Article  >  Web Front-end  >  CSS attribute value specifications you must know

CSS attribute value specifications you must know

王林
王林forward
2020-06-12 15:42:142900browse

CSS attribute value specifications you must know

1. If the value is 0, usually no unit is needed

For example:

.list{
    border: 1px solid 0px;
    margin: 0px;
}

is changed to:

.list{
    border: 1px solid 0;
    margin: 0;
}

But there is a special case, that is, the time unit related to time must include seconds. The following two are illegal:

transition-duration: 0;
transition: transform 0 linear;

2. Use sixteen for color value In base system, use less rgb

as follows:

color: rgb(80, 80, 80);

is changed to:

color: #505050;

Because using rgb is a function, it also needs to calculate the conversion. If it is with transparency, then use rgba.

If the six numbers of the color value are the same, then just write 3:

color: #ccc;

3. Pay attention to the difference between border none and 0

The following two have the same meaning:

border: 0;
border-width: 0;

And the following two have the same meaning:

border: none;
border-style: none;

So the border can be removed using 0 and none.

Although the packaging tool will handle it for us in the end, it is still important to maintain a good writing habit.

Recommended tutorial: css quick start

The above is the detailed content of CSS attribute value specifications you must know. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:juejin.im. If there is any infringement, please contact admin@php.cn delete