Put a DIV in the lower right corner of another div with CSS positioning

<div id="box1"> 
<div id="box2">测试内容</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> 

 

Relative positioning of the parent object, absolute positioning of the child object with the parent object as the reference point the outer div is set to relative positioning, and the inner div is set to absolute positioning;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325206055&siteId=291194637