Home Web Front-end HTML Tutorial Some suggestions for DIV CSS layout_html/css_WEB-ITnose

Some suggestions for DIV CSS layout_html/css_WEB-ITnose

Jun 24, 2016 pm 12:31 PM

http://www.cnblogs.com/bindsang/archive/2008/07/28/1254385.html

Some suggestions for DIV CSS layout

I have been playing with Web refactoring for a while, and I have gained some experience. Netizens often ask Caizi some questions about layout. Some friends in the SvnHost group asked Caizi to write more tutorials about layout to help some novices. Caizi also promised to write more about Caizi’s own experience and experience in layout. Share your experience with everyone.

Many people think that web reconstruction is just a simple DIV CSS layout. This is obviously a wrong concept. I don’t want to explain it more in detail. There are a lot of articles on this aspect. DIV CSS layout is indeed a very important part of reconstruction. Today, Caizi will talk about some suggestions on layout.

1. Please design a layout that suits your own style (including XHTML and CSS).

In fact, every website designer generally has his own style, so please design a set of layout methods that you like individually, including XHTML and CSS. Please be sure to skillfully remember the dependency relationships between various layout modules. A schematic diagram will be attached at the end of this article.

2. Please be sure to add a unique ID identifier to each module participating in the layout. Such as #header, #content, #footer, etc.

Maybe you don’t need to define separate styles for each module in CSS at the moment, but do you dare to say that you won’t need it in the future? If you are not sure, please add ID. And please understand that the ID mark is not only for the convenience of defining its style in CSS, it is also a DOM node. For future expansion, this ID is also very necessary.

3. Please do not use any other element tags except div to participate in the layout.

Many people may have questions about this. Don’t we even need to use tags like span, ul, li, p, h1, h2...? Of course not, please see clearly, Caizi refers to the layout, and these tags are just containers for some content that need to be used to render some effects, and have nothing to do with the layout.

4. Some places in the content require special rendering. You can use element tag styles for rendering. Please don't complicate it and use other class selectors for rendering.

This point is a bit hard to explain, so please read this article: Clever use of uncommon tag elements in XHTML, that’s about it.

5. Please make good use of comments, indentation, and blank lines.

No matter what code it is, whether it is XHTML, CSS, JS, or background program code, it all applies. For example, in the XHTML code, a comment is added at the beginning of each module to explain what module it is. Please pay attention to the indentation of the nested divs at each level. The next level has one more indentation than the previous level. The structure must be clearly visible at a glance. Please don't be stingy with one or two blank lines between each module. If you do these things, you will find that whether you look at the source code yourself or others look at the source code, it will be easy to get started. If you need to modify it, , will greatly improve efficiency.

6. When working on a project, be sure to write a development document.

Development documents are some key points in the development process, which must be recorded, such as the directory structure (if necessary, it is best to record the functions of each directory and file), page layout, etc., so that you can conveniently record them at any time After reading it, if someone needs to change people to do this project in the future, it will be easy for them to take over.

That’s all for now, there may be many more things worth noting, I will add them as soon as I think of it, thank you!


Regarding point 1, here is a layout diagram of a corporate website that Caizi helped people make some time ago:

This is a typical layout of three rows and two columns, above It is the header, the middle is content, the middle is divided into left and right parts (sidebar and main), and the bottom is footer. The big structure is very clear and no further explanation is needed. Let’s take a rough look at how the specific layout is:
The outermost layer of the website is a large container #wrap, and all the content is packed inside. As long as its width is defined, the whole situation will take effect. It is recommended to define an outer container in this way. layer container.
The top is the header container, which has three modules, divided into upper and lower layers. The upper layer is divided into two left and right modules, logo and banner, and the lower layer is the nav module, which is the menu.
In the middle is the content container, which is divided into two large modules on the left and right, sidebar and main. The sidebar has two upper and lower modules, login and recommend modules, and the main on the right also has two upper and lower modules, ad and product.
The bottom is the footer container.
Finally, a simple source code of the above layout is attached for reference only!
 标准的三行两列布局 

     
         
             
Product
    
  
  


The work of the romantic talent, please keep the original address link when reposting, thank you for your cooperation!
Caizi’s Nest: http://www.54caizi.org/

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1252
24
Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

HTML: The Structure, CSS: The Style, JavaScript: The Behavior HTML: The Structure, CSS: The Style, JavaScript: The Behavior Apr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML, CSS, and JavaScript: Web Development Trends The Future of HTML, CSS, and JavaScript: Web Development Trends Apr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The Future of HTML: Evolution and Trends in Web Design The Future of HTML: Evolution and Trends in Web Design Apr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative Overview HTML vs. CSS vs. JavaScript: A Comparative Overview Apr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Building the Structure of Web Pages HTML: Building the Structure of Web Pages Apr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML vs. CSS and JavaScript: Comparing Web Technologies HTML vs. CSS and JavaScript: Comparing Web Technologies Apr 23, 2025 am 12:05 AM

HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

HTML: Is It a Programming Language or Something Else? HTML: Is It a Programming Language or Something Else? Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

See all articles