My Opinion on Div + CSS

Source: Internet
Author: User

Structure and Performance separation, which is my opinion on Div + CSS.

I have discussed with my colleagues today and mentioned the advantages and disadvantages of Div + CSS. I would like to write my personal views here. It's just my personal opinion. It's a one-sided one. You are welcome to correct and discuss it.

I personally think that DIV + CSS is a way of thinking, separating structure and performance. DIV is a structure, and CSS is a manifestation.

When writing Div + CSS, you do not need to use Dreamweaver or other visible compiling methods.CodeWhat is written on, and what is the result. Of course, you need to test different browsers. Compatibility testing is a problem and requires a lot of experience. Let's talk about it later.

When writing Div + CSS, first draw a sketch, draw the structure and position, form a rough idea in your mind, and then start to do it.

Next, write the DIV and write the structure. When writing the structure, you must have a good habit of using a common name to increase the readability of the Code. Div + CSS separates the structure and representation, so that you can only consider the structure or performance when writing. I usually write the structure first and then CSS. My colleagues prefer to write CSS first and then structure. I personally think this is just a habit and there is no big difference.

The structure of Div + CSS can be clearly written. It is simple, clear, and easy to understand. The header is the header, the navigation is the navigation, the content block is the content block, and the foot is the foot, which is a large structure. Next, there are IMG, P, UL, Li, span, etc. There is also a form that is very clear and easy to understand.

Write CSS after writing the structure. I am used to writing a common CSS with some code such as the header and foot, and then write a CSS for every page, mainly considering the convenience of modification in the future.

OK, the structure is well written, the performance is well written, and some modifications have been made to make the page more beautiful, but it is not complete yet. Remember to test it !!

Before that, we need to mention that when correcting pages, we often find that the desired effect is a strange thing, wrong, or empty, or, it's strange that a layer disappears. Do not worry. You can try to increase the width and height or write them as negative values to see what will happen and write them more slowly, it will understand how some common problems occur. I encountered a headache many times when I first learned it. But I only found out after reading a book. Wow, it turned out to be the case! Therefore, I personally think it is best to read one or two books systematically when Learning Div + CSS. Some areas that will be ignored during disorganized learning will often become obstacles in the future.

You must test it after writing it, because different browsers are very likely to have different effects. The most famous thing is that ie5's three-pixel drive-by and hide-in. Remember to test in different browsers to improve code compatibility.

I think a very good idea for div + CSS is to design the structure, and then what you want to express it as, and where you want it to be put. However, I personally think that a good page is designed first and then written, instead of constantly modifying it to meet your requirements. Otherwise, the code will become messy and hard to read.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.