怎样把一个DIV放到另一个div右下角?_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:31:41
Original
1374 people have browsed it

怎样把一个DIV放到另一个div右下角???

借助CSS定位来实现,你将右下角的那个DIV放在另一个DIV里面,参考代码如下示:

测试内容

<style><!--#box1{width:600px;height:600px;background:green;position:relative}#box1 #box2{width:200px;height:200px;background:red;position:absolute;right:0;bottom:0}--></style>
Copy after login

父对象相对定位,子对象以父对象为参考点绝对定位;

外层的div设置为相对定位,内层的div设置为绝对定位;

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