Summary of CSS layout basics_html/css_WEB-ITnose
One-column layout
Two-column layout
If float is not added, side-by-side two-column layout cannot be achieved.
Three-column layout
Three-column layout: left and right fixed, middle adaptive:
- Standard document flow
- Floating
- Absolute positioning
{ display: none; /* 不占据空间,无法点击 */ }{ visibility: hidden; /* 占据空间,无法点击 */ }{ position: absolute; clip:rect(1px 1px 1px 1px); /* 不占据空间,无法点击 */ }{ position: absolute; top: -999em; /* 不占据空间,无法点击 */ }{ position: relative; top: -999em; /* 占据空间,无法点击 */ }{ position: absolute; visibility: hidden; /* 不占据空间,无法点击 */ }{ height: 0; overflow: hidden; /* 不占据空间,无法点击 */ }{ opacity: 0; filter:Alpha(opacity=0); /* 占据空间,可以点击 */ }{ position: absolute; opacity: 0; filter:Alpha(opacity=0); /* 不占据空间,可以点击 */ }
Add overflow: hidden
at the parent level. Advantages: There are no structural and semantic problems, and the amount of code is very small.
Advantages: There are no structural and semantic problems, and the amount of code is very small
Disadvantages: It makes elements adjacent to the parent element The layout will be affected and it is impossible to float all the way to the body. It is not recommended to use
Advantages: The structure semantics is completely correct and the amount of code is very small
Disadvantages: Box model The attributes have been changed, and the resulting series of problems are not worth the loss. It is not recommended to use
Advantages: It should be noted that: after is a pseudo-element, not a pseudo-class (some CSS It is called "pseudo-object" in the manual), and many articles such as Clear Float are called pseudo-classes. However, CSS should be more rigorous. This is an attitude.
Since IE6-7 does not support :after, use zoom:1 to trigger hasLayout.
Disadvantages: Compatibility is not very good.
Clear floats
Advantages: Simple and clearDisadvantages: Meaningless empty tags, not conducive to semantics
DIV CSS specification named collection
DIV CSS naming reference tablewrapper | Page peripheral control overall layout width | master.css, style.css | main | |
container or #content | container, used for the outermost | module.css | Module | |
layout | Layout | base.css | Basic common | |
head,#header | Header part | layout .css | Layout, layout | |
foot, #footer | Footer part | themes. css | theme | |
nav | main navigation | columns.css | Column | |
subnav | Secondary navigation | font.css | Text, font | |
menu | menu | forms.css | form | |
submenu | Submenu | mend.css | Patch | |
sideBar | Sidebar | print.css | ||
sidebar_a,#sidebar_b | Leftbar or Right column | |||
main | Page body | |||
tag | tag | |||
msg#message | Prompt message | |||
tips | Tips | |||
vote | Vote | |||
friendlink | Friendlink | |||
title | title | |||
summary | Summary | |||
loginbar | Log in Bar | |||
searchInput | Search input box | |||
hot | Hot Hotspot | |||
search | Search | |||
search_output | Search output is similar to search results | |||
searchBar | Search bar | |||
search_results | Search results | |||
copyright | Copyright information | |||
branding | Trademark | |||
logo | Website LOGO | |||
siteinfo | Website information | |||
siteinfoLegal | Legal Notice | |||
siteinfoCredits | Reputation | |||
joinus | Join us | |||
partner | Partner | |||
service | Service | |||
regsiter | Register | |||
arr/arrow | arrow | |||
guild | Guidelines | |||
sitemap | Sitemap | |||
list | list | |||
homepage | Homepage | |||
subpage | Secondary page sub-page | |||
tool,#toolbar | Toolbar | |||
drop | Drop-down | |||
dorpmenu | 下拉菜单 | |||
status | 状态 | |||
scroll | 滚动 | |||
.tab | 标签页 | |||
.left.right.center | 居左、中、右 | |||
.news | 新闻 | |||
.download | 下载 | |||
.banner | 广告条(顶部广告条) |
传统方式

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

The article discusses the <iframe> tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.
