DIV+CSS layout should focus on semantics, the reuse of code!

Source: Internet
Author: User
Css

A common page is nothing more than HTML and CSS and JS script composition, relatively before, we are using a table (table) to achieve the layout of the page, and now, the pursuit of a layer (div) to layout. Many friends say that using a layer (div) layout with a table (table) layout is very different, I agree, because tables (table) is used to reflect two-dimensional data. But since we used to, and have been using, it also means that the table layout is OK. But why do we need to use layers (div) to layout now? Because we want every label in HTML to be semantically well represented, even looking at the source code can be very clear about its role.

Think about the previous, what CSS style, what HTML code regardless, as long as can be in FrontPage or Dreamweaver on the page to be reflected on the effect on it. And now, everyone gave up FrontPage, why? Because FrontPage produces a lot of useless code that can affect the readability of your code. Now that you have noticed this, what is the current refactoring, the standard, for what, and not for the readability of the code?

It is said that the reconstructed station is to separate the performance from the structure, so that all the performance and structure are separated from the finished? No! We also need to use the content of the performance, and is repeated use, not once used to not. If you want to show the content as a one-time chopsticks used once, then do not, that refactoring your site seems to have little meaning, but let your style files become more changeable. To reuse the content of the performance, the structure of things to do will also affect the style of the call, and if the semantics of each structure with a very appropriate label to reflect, that the source code is a great improvement in readability.

Once saw a friend reconstructed the site, he is a

all the content of the page is included in it, I was thinking, what is the point of doing so? Is it the same as the original with a
all the contents of the page included in it? It's not that it's not, it's not wrong, it's just that we don't have to do it structurally, do we? Generally the most common is the upper (the head) (content) under (copyright information) Three parts, relatively such, we can use three
to achieve.



In contrast, it's always better to constrain content than

a big box.

The last thing to say is that now the browser is not unified, supporting the content is different, although we can use the hack method to achieve what we want, but why don't we make a little sacrifice. If the influence on the layout is not big, can you give up the method of using hack? Are your clients going to use different browsers to see how the effects are compared? Hack used more, only to the later changes to bring trouble.

According to Fei Fei said, I here are the P words, summed up can be a sentence: that is to pay attention to semantics. Pay attention to the reusability of the code.
The ability to express is not good, please don't be offended. I didn't write anything.



Related Article

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.