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

What are the mistakes you often make when writing CSS

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces "what are the mistakes often made when writing CSS". In daily operation, I believe that many people have doubts about the mistakes often made when writing CSS. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "what are the mistakes often made when writing CSS?" Next, please follow the editor to study!

Font Size

I often make mistakes between font-size and font-weight, as follows:

.title {font-size: bold;}

Opacity I don't know why, but sometimes I forget to write the percentage:

.title {opacity: 50;}

I often make the following mistakes about opacity:

Title {/ * this is not easy now. Do you see where the mistake is? * / opaciy: 0.5

Font Weight

Is it light or lighter?

.title {font-weight: light;}

Padding

What happens when you think the property is padding, but you actually use padding-top?:

.section {padding-top: 10px 20px;}

Talent, excellence?

CSS Grid

For CSS Grid, sometimes I subconsciously write grid-column instead of grid-template-columns:

.section {grid-columns: 1fr 1fr 1fr.}

CSS variable

For the use of the CSS variable, I often forget to write var?:

.title {color:-- brand-color;}

The correct way to write is as follows:

.title {color: var (--brand-color)}

Box Shadow?

For resetting box-shadow, I often use 0 to reset:

.title {/ * illegal * / box-shadow: 0;}

The correct way to write is as follows:

.title {box-shadow: none;}

Visibility

Hidden elements can be used with visibility, but I often write this:

.title {visibility: none;}

The correct way to write is as follows:

.title {visibility: hidden;}

Width

When it comes to width, it sometimes gets out of your head. Write this:

.title {widows: 100px;}

Offset attribute

For the css offset attribute, I often write this as well:

.elem {left: 14;}

What is missing, everyone understands it?

CSS calc ()

If your code doesn't have the function of highlighting prompts, you might write the same thing?

.elem {font-size: clac (14px + 1vw);}

CSS color

I remember having encountered such a mistake.

.elem {color: # red;}

Display

Needless to say, we all realize for ourselves:

.title {display: absolute;}

Transforms?

Title {translate: (- 50%,-50%)} at this point, the study of "what are the mistakes you often make when writing CSS" is over. I hope you can solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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