<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>测试</title> <style> body { margin: 0; padding: 0; font: 14px/1.5 '微软雅黑'; } .article { position: relative; height: 40px; overflow: hidden; } .article__many { position: absolute; top: 20px; right: 5px; background-color: #fff; padding: 0px 7px; border-radius: 3px; cursor: pointer; } .h-auto { height: auto!important; } .s-hidden { display: none; } </style> </head> <body> <article class="article"> 测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容测试内容 <span class="article__many" id="J-many">阅读更多>></span> </article> <script type="text/javascript"> document.getElementById('J-many').addEventListener('click', function(e) { var curTarget = e.currentTarget; curTarget.setAttribute('class', 's-hidden'); curTarget.parentElement.setAttribute('class', 'article h-auto'); }); </script> </body> </html>