问题如下图,蓝色框根据红色框,得到相对于红色框左上角的偏移(x,y)<!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>Document</title><style> .box { width: 1200px; padding: 50px; box-sizing: border-box; border: 1px solid #ff0000; } .box-item { display: flex; padding: 20px; box-sizing: border-box; border: 1px solid #ccc; } .box-item .item-left { flex: 1; } .box-item .item-right { flex: 0 0 150px; width: 150px; height: 50px; box-sizing: border-box; border: 1px solid #00aaee; }</style></head><body><div class="box"> <div class="box-item"> <div class="item-left">aa</div> <div class="item-right"></div> </div> <div class="box-item"> <div class="item-left">bb</div> <div class="item-right"></div> </div> <div class="box-item"> <div class="item-left">cc</div> <div class="item-right"></div> </div></div></body></html><script type="text/javascript">function doPrint() { window.print();}</script>
添加回答
举报
0/150
提交
取消