Div + CSS layout

xiaoxiao2021-04-08  377

Are you learning CSS layout? Is it still can't fully master the pure CSS layout? There are usually two cases hinder your learning:

The first one may be that you haven't understood the principle of the CSS processing page. Before you consider your page overall performance, you should first consider the semantics and structure of the content, and then add CSS to the semantics. This article will tell you how to structure HTML.

Another reason is that you have no more familiar performance layer properties (for example: cellpadding, hspace, align = "left", etc.), do not know what CSS statement that converts to the corresponding. When you solve the first question, I know how to structure your HTML, I will give a list again, and the original performance attribute is used for any CSS instead.

Structured HTML

When we just learned the webpage, we always consider how to design, consider those pictures, fonts, colors, and layout solutions. Then we draw from Photoshop or Fireworks, cut into small images. Finally, all designs restore all designs restore on the page by editing HTML.

If you want your HTML page with a CSS layout (CSS-friendly), you need to look back, you don't think about "look", you must first think about the semantics and structure of your page.

The appearance is not the most important. A good HTML page can be manifested in any appearance, CSS Zen Garden is a typical example. CSS Zen Garden helps us ultimately recognize the power of CSS.

HTML is not only on the computer screen. You may not be displayed on the PDA, mobile phone and screen reading machine with photoshop. But a good HTML page can be displaced anywhere, any network device.

Start thinking

The first thing to learn is "structure", some writers are also called "semantics". This term means you need to analyze your content block, and the purpose of each content service, and then establish a corresponding HTML structure based on these contents.

If you sit down and carefully analyze and plan your page structure, you may get a few pieces like this:

Sign and site name

Main page content

Site navigation (main menu)

Submenu

search bar

Ribbon (such as shopping cart, cashier)

Footers (copyrights and relevant legal statements)

We usually use DIV elements to define these structures, similar to this: