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

How to optimize CSS Code Writing

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Today, I will talk to you about how to optimize CSS code writing, many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

As we all know, a very important point of SEO optimization is layout, and DIV+CSS layout is better than TABLE, so let's briefly introduce CSS code writing optimization.

Most of the time, especially for beginners, there will be a lot of CSS code, which makes others look complicated! There are two ways to avoid this problem! First: through constant training, constantly writing code to optimize their own code, another method will be what I will talk about!

To know how to optimize your code, you must first know the priorities in CSS. I'll talk about the priorities of CSS in the next article, which we won't talk about for now. Look at the following code:

The code is as follows:

* {

Margin:0px

Padding:0px

}

Html,body {

Font-family:Arial, Helvetica, sans-serif

Font-size:12px

}

H2,h3,h4,h5,h6 {

Font-size:14px

Color:#000

Font-weight:normal

}

Span {

Font-size:14px; font-weight:bold; color:#000

}

Ul, ol {

List-style:none

Margin:0px

Padding:0px

}

Li {

Display:block

Float:left

}

Img {

Border:none

}

A {

Text-decoration:none

}

A:hover {

Text-decoration:underline; color:#000

}

Explanation: put this code in your CSS. CSS file, and then in other CSS files @ import url ("css.css"); in fact, the above code is just a summary, meaning the above tag, in your future CSS code to write about this tag, just to use this attribute, then you can ignore not to write!

For example: img {in the above code

The code is as follows:

Border:none

}

When you encounter a picture to be defined in other files, like this:

The code is as follows:

# tab img {

Float:left

}

At this point, the CSS of # tab img will look like this

The code is as follows:

# tab img {

Float:left; border:none

}

So sometimes you want the frame of the picture to be 1, so you can write like this:

The code is as follows:

# tab img {

Float:left; border:1px

}

At this time, the border of all the images in # tab is pulled as 1 ~ because this is more priority than the above CSS. CSS files have a high priority!

After reading the above, do you have any further understanding of how to optimize CSS code writing? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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