Home > Web Front-end > HTML Tutorial > CSS DIV: relative positioning of parent DIV and absolute positioning of child DIV_html/css_WEB-ITnose

CSS DIV: relative positioning of parent DIV and absolute positioning of child DIV_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:27:40
Original
956 people have browsed it

How to absolutely position a div within a div? It's very simple, just set the position attribute of the parent div to relative and the position attribute of the child div to absolute. . .

Example:

<html><body><div>xxxxx<div><div style="border:1px red solid;width:100%;height:50px;position:relative"><div style="border:1px red solid;width:20px;height:20px;position:absolute;right:0;top:0">x<div><div></body></html>
Copy after login

Effect:

source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template