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 CSS skills in project practice?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article shows you what the CSS skills are in the project practice, which are concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Using DIV+CSS layouts has become a popular trend, of course, for a reason. That is determined by DIV+CSS 's own advantages.

When we are doing DivCSS layout, we pay great attention to the learning of CSS skills. In the previous article, we also introduced a lot of related knowledge and experience. Today we recommend 3 CSS skills to you! Although there is nothing new, it is very important for beginners!

First, declare CSS on one line

H2 {font-size:18px; border:1px solid blue; color:#000; background-color:#FFF;} h2 {font-size:18px; border:1px solid blue; color:#000; background-color:#FFF;}

The second one does look formatted, but it doesn't help in reading. Writing on one line allows you to find the parts you need more quickly.

I also wrote it in a similar way, but gradually found that, as the article said, it was of little use. A line looks crisp, saves space and makes the file smaller.

Second, write code in blocks

Writing code in this way makes CSS more page-oriented and can find the problem in the shortest possible time when something goes wrong. It looks like this:

Ww.52css.com] # content {float:left;} # content p {… } # sidebar {float:left;} # sidebar p {… } # footer {clear:both;} # sidebar p {… }

III. Browser compatibility

Only * * browsers are supported. That means giving up IE5 and IE5.5. This will save a lot of time. There is no need to use the box model Hack for IE6. If it is only for popular browsers, you can achieve the same effect with very little Hack.

I noticed the CSS of NetEase's new home page, and it turned out to be one of them! important or Hack is not available, but the display effect is very good in FF and IE. Reasonable use of CSS can avoid Hack. Of course, debugging will take a little more time.

All contents that contain floating elements in the container should be designed to be consistent with the container. If it is too large, it will slide to the wrong position. Adjusting outside the container with a negative value margin can also cause slippage.

Understand Overflow if you have two floating elements in the page and output too much in the left container, it will cause the right container to run below. This means that your margin, width, or padding settings are confused, but they are not reflected in FF. Use overflow:hidden or overflow:scroll to prevent IE from allowing content to rush out of the container.

What are the CSS skills in the project practice? have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

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