In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces you to easily write CSS skills, the content is very detailed, interested friends can refer to, hope to be helpful to you.
8 simple and practical skills for writing CSS
This article mainly helps friends who have just come into contact with CSS, through this article, we can help you understand CSS better.
1. structure
Keeping the CSS structure clear not only helps to keep the CSS file simple, but also helps to check and change it later.
This is not recommended:
BODY
{margin-top:5px; font-family:Arial,Helvetica, sans-serif;font-size:14px;color:#3b5f83;}
This is the recommended way to write:
BODY
{margin-top:5px; font-family:Arial,Helvetica,sans-serif; font-size:14px; color:#3b5f83;}
two。 Keep it simple.
Keeping the code concise can significantly reduce the size of the CSS file.
Not recommended:
Padding-top:10px; padding-right:5px
Can be abbreviated to:
Padding:10px5px00
3.Paddingvs.Margin
Margin is the least compatible attribute for browsers. Therefore, the Padding attribute should be used whenever possible, as long as conditions permit.
4. Integration
In the following example, a common Class is defined to replace the same code used in different places: color:grey.
. header-content {font-size;12px; color:grey;} .body _ content {font-size:12px; color:grey;} .footer _ content {font-size:11px; color:grey;}
In fact, it can be like this:
* {color:grey;} .body _ content {font-size:12px;} .footer _ content {font-size:11px;}
5. Annotation
Adding a simple comment in the right place will not only help you understand the code, but others can also understand your code well.
/ * the URL www.zdbase.com*/ is defined here.
6. Verification
* validate the CSS file that has been created, which can help you find errors in the file.
7. Avoid using styles in XHTML
Do not use styles in Xhtml code, which will not only increase the size of the web page file, but also confuse and complicate the code. For example, the following are not recommended:
This method of using style is not good h3 > div >
8. Naming
Use standard ID and Class names that can be understood literally, not just code names.
The following are not recommended:
.a1 {color:grey;} .b1 {font-size:11px;}
This is the recommended way to write:
Body _ content {color:grey;} .foot _ content {font-size:11px;} skills about easy writing CSS are shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.