子元素margin带动父元素拖动
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>活动</title> <style> .top{ background: orange; padding-top:1px; /*border:1px solid transparent;*/ /*overflow:hidden;*/ } .abs{ position: absolute; top:40px; right:20px; } </style> </head> <body> <div class="top"> <div class="page-header"> <h2 class="text-center text-danger">活动</h2> <span class="text-right pull-right abs"><img src="src/assets/logo.png" alt="" width="30" height="30"></span> </div> </div> </body> </html>