代码:
实例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <style type="text/css";> div { width: 300px; height:200px; padding: 15px; border-radius: 15px; box-shadow: 5px 5px 5px #888; background-color: goldenrod; background-size: 300px 200px; background-repeat: no-repeat; } .text { color:#363636; text-indent: 2em; line-height: 1.5em; } </style> <div> <h3 style="color:brown;text-align: center;font-size:20px" onmouseover="change(this)" onmouseout="old(this)" >旷工</h3> <p class="text">有位非常漂亮的女同事,有天起晚了没有时间化妆便急忙冲到公司。结果那天她被记旷工了……吃惊</p> </div> <script type="text/javascript"> function change(element) { element.style.fontSize = '24px' element.style.color = 'green' } function old(element) { element.style.fontSize = '20px' element.style.color = 'brown' } </script> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例