All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
用打车软件“拼车”回家,需要注意这些 - 拼车,打车软件
Microsoft: 4 is not enough, little ice will “marry“ more than 10 square platform,
夫妻10万元淘宝网购马代游被骗,落地后成“流浪者” - 网购,淘宝
Female passengers said was the driver to beat: customer service pay 3 Yuan voucher,
联想刘军意外离职:或许是因为这个 - 联想,刘军
Court was PS scandal to blackmail the active transfer 520,000: not bad money case
央行拟为网络第三方支付定规矩:每天限额5000元 - 第三方支付
警方调查斗鱼TV,海量不雅视频曝光成快播第二 - 斗鱼TV,网络主编,斗鱼直播
AMOLED与TFT-LCD屏幕之间究竟有何区别? - AMOLED,LCD,显示屏
高通或考虑分拆业务:英特尔虎视眈眈 - 高通,英特尔
Reading number is top 10 pictures
玩手机对身体不好
Parking technology is great, that give you the keys can't stolen
In 2013 hercules Arnold classic2
银行20年后可能消失
2013中国四川省高考作文
29 the belle stars after bath figure2
Gang rape
Sora aoi in China2
A man's favorite things14
Fierce! China's special forces training the devil1
Download software ranking
WebService在.NET中的实战应用教学视频 → 第1集
Visual C++界面编程技术
Boxer Classic video1
WebService在.NET中的实战应用教学视频 → 第4集
Boxer's Top ten classic battle10
Proficient in JavaScript
虚拟机5.5.3版
超级战舰
Photoshop 8.0图象编辑软件
DreamWeaver8
published in(发表于) 2016/5/7 5:51:42 Edit(编辑)
10 CSS development “do not“,

10 CSS development “do not“,(CSS开发中的10个“不要”,)

English

中文

10 CSS development "not"-CSS, programming-IT information

Self in this business, I found that developers have been trying to conquer the CSS.

Reason is sufficient, developers think in logic creature. Add a DIV element leads to all the code has to move down one line, while another DIV "float" to the left, I feel doesn't make any sense.

You must have heard developers complain about:

"We just need to move the five pixels to the left, but ... Oh, my God! Why are moved down the row as a whole. Where the hell is wrong?!?!?! ”

So, today we will talk about ten errors in the CSS approach.

According to my experience as a developer using CSS, here are my ten "no".

1. do not abuse the class

Meaningful use ID instead of a class. This is a method that enables browsers to access DOM elements faster.

2. do not throw everything into a CSS file

Partition CSS makes it easier to manage. Each CSS file can be broken down into for example header.CSS, footer.CSS and other logical components.

3. don't name selector to ". red-with-green-dashed-lines" (red and green dashed line)

Named according to the component on the page of your choice. For example: "header-left", "content-title" or "content-date" is more descriptive.

4. don't forget to comment

Comments in CSS is very important, to understand how each style and other styles available associate and what color scheme applies to which components.

5. don't be afraid to development tools

Now, each browser has its own set of development tools, usually by pressing F12. These tools are the "Debugging CSS" is crucial.

6. don't be afraid to cover

Of course, CSS frameworks, such as Bootstrap and Foundation is great, but each needs to make adjustments according to your needs. When you get an update of the framework, it will overwrite your changes. Instead of digging a large CSS file, it is better to create a bootstrap-overrides.CSS file, you will resize the frame, just ...

7. do not abuse! Very important

The whole idea of CSS is, from one to another, "cascading" style.! key to keep in mind like mine to step through all the previous style. :?-)

8. do not use a lot of Web fonts

This is obvious, but some people just like their layout. Only use one or two on the site (up to three) network fonts, then back to the browser default settings to keep the website optimization.

9. don't hand-code all the CSS

In keeping with CSS DRY, you can use CSS pre-processor like SASS or LESS. Using the preprocessor's biggest advantage is that you can define a variable, for example in the color scheme defined above, then repeat using all CSS, instead of when you need to modify the track each color.

10. don't let the CSS too "bloated"

Space space space takes up the CSS file. Because we want our CSS to load quickly, so before deployment to the Web site better to use CSS compress tools to a thin body.

Just above me, as a developer in the preparation of the CSS should not do things. Welcome to put forward different views.


CSS开发中的10个“不要” - CSS,编程 - IT资讯

自我进入这个行业,我就发现开发人员一直在努力征服CSS。

理由也很充分,开发人员是用逻辑思考的生物。添加一个DIV元素导致所有代码都不得不往下移一行,而另一个DIV“浮”到左侧,感觉没有任何意义。

你也一定听到过开发人员的抱怨:

“我们只需要向左边移动五个像素,但是…天哪!为什么整个都向下移动了一行。到底是哪里错了?!?!?!”

所以,我们今天就来聊一聊CSS中的十大错误的做法。

根据我作为开发人员使用CSS的经验,下面是我的十个“不要”。

1.不要滥用类

在有意义的地方使用ID而不要使用类。这是一个使得浏览器能够更快访问DOM元素的方法。

2.不要把一切都扔进一个CSS文件中

分区CSS使其更易于管理。每一个CSS文件都可以分解成例如header.css、footer.css等逻辑组件。

3.不要命名选择器为“.red-with-green-dashed-lines”(红绿虚线)

根据页面上的组件命名你的选择器。例如:“header-left”,“content-title”或“content-date”更具描述性。

4.不要忘记注释

注释在CSS中非常重要,可用来理解每个样式如何与其他样式关联以及什么颜色方案适用于哪些组件。

5.不要害怕开发工具

现在的每个浏览器都有自己的一套开发工具,通常是按F12。这些工具在“调试CSS”时至关重要。

6.不要害怕覆盖

当然,CSS框架,例如Bootstrap和Foundation都较为巨大,但每一个都需要根据你的需要做出一点调整。当你得到一个更新的框架时,它将覆盖你的改变。与其深入挖掘庞大的CSS文件,还不如创建一个bootstrap-overrides.css文件,按照你的意愿调整框架,只是…

7.不要滥用! 很重要

CSS的整体思路是,从一个到另一个地“层叠”样式。!重点是要记住排雷一样地踏遍所有早先的样式。: -)

8.不要使用大量网络字体

这也是显而易见的,但有些人就是喜欢自己排版。只在网站上使用一个或两个(最多三个)网络字体,然后回归到浏览器默认设置,以保持网站的优化。

9.不要手动编码所有的CSS

为了保持CSS的DRY,可以使用CSS预处理程序例如LESS或SASS。使用这些预处理器的最大好处是,你可以定义变量,例如在上面定义配色方案,然后重复使用到所有CSS,而不必当你需要修改的时候追踪每个颜色。

10.不要让CSS过于“臃肿”

空格会占用CSS文件的空间空间。由于我们都希望我们的CSS能够快速加载,因此在部署到网站之前最好使用CSS压缩工具来一次瘦身。

以上只是我作为一个开发人员在编写CSS时认为不应该做的事情。欢迎提出不同的看法。






添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.