Home  >  Q&A  >  body text

html - 如何写出较好的css?

  1. 在上IFE前端学院, 在完成任务 发现一个问题,
    大家都是架构一个页面. 还原度差不多类似, 但是我的CSS可能是别人的两倍长

  2. 然后我看了别人的源码, 发现他们设计的很巧妙, 而自己没有这样的意识

  3. 发现自己的CSS布局是对html分块之后逐步细化很臃肿, 但是别人的css标签就很有意义,也很精炼

所以我想问 如何能够提高自己的CSS的水平, 写出优秀的css代码, 或者是如何养成一种良好的css布局的想法?

高洛峰高洛峰2741 days ago2023

reply all(15)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 13:06:44

    1. When making a page, don’t rush to write. First abstract the styles that can be shared. A component can use multiple classes to implement its style.
    2. Simplify the implementation. When you feel that it takes a long time to create an effect, think about whether there are other solutions; with more experience, you will naturally make progress.
    3. If you are really interested, you can buy a copy of "CSS Design Patterns" and take a look.
    4. When you write a certain amount of code, you can take a look at the implementation of some famous front-end frameworks, or you can try to use less and sass.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 13:06:44

    You must first have good DOM architecture habits before you can write good CSS~

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 13:06:44

    It is recommended to take a look at the Bootstrap framework (http://getbootstrap.com) and refer to its design ideas and source code. You can ignore the content of LESS or SASS for the time being.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 13:06:44

    Clean, easy to read, and less redundant~

    reply
    0
  • 阿神

    阿神2017-04-17 13:06:44

    There is a concept of OOC, object-oriented css programming, I hope it helps

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 13:06:44

    Does anyone want to form a team? I haven't found a team yet, and the teams I applied for are all under review.

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 13:06:44

    Recommend Zhang Xinxu’s blog
    http://www.zhangxinxu.com/wordpress/page/2/?s=%E5%B8%83%E5%B1%80

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 13:06:44

    Recommend "Mastering CSS: Advanced Web Standard Solutions (2nd Edition)"
    http://item.jd.com/10064452.html
    The basics of CSS are explained very thoroughly and very useful. Make sure the css in your mind is no longer a mess

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 13:06:44

    I strongly recommend a book to you. I have been paying attention to the Chinese version of "CSS Secrets" since last year and it was launched at the end of this month. The Sunflower Book of CSS.

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 13:06:44

    CSS Zen Garden This book is also good. . .

    reply
    0
  • Cancelreply