效果图:
代码:
<!DOCTYPE html><html><head><meta charset="UTF-8"><title>规避脱标流</title><style type="text/css">.father{width:400px;height:400px;background:red;}.son{width:100px;height:100px;background:black;margin-left:auto;/*margin-left:auto;意思是往右边走margin-right:auto;意思是往左边走margin:0 auto;是二者的中和,即中间*/}</style></head><body><div class="father"><div class="son"></div></div></body></html>