div+css之定位_html/css_WEB-ITnose
1.相对定位(relative)
所谓相对定位是指,相对该元素应当显示的左上角重新定位,虽然它脱离了标准流,
但它原来的空间不能被占用。
2.绝对定位(absolute)
所谓绝对定位是指,对该元素最近的那个脱离了标准流的元素(父元素)定位,如果没有
父元素(或者有父元素,但父元素没有脱离标准流),则相对body左上角定位。
3.固定定位(fixed)
所谓固定定位,就是不管怎样,总是以视窗的左上角定位。
注意:left,top对static静态定位无效。static定位是靠margin-left和margin-top
来定位的。
4.z-index
用于设置对象(div)显示的时候,层叠的属性,z-index值越小,则越在下层显示
5.当我们想使用绝对定位时:必须要有两个条件
【1】必须给父元素加定位属性,一般建议使用position:relative;
【2】给子元素,加绝对定位position:absolute;同时要加方向属性;

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

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

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

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.

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...
