3月15日学习
代码:
实例
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>开心一刻</title> <style type="text/css"> div { width: 500px; height:280px; padding: 15px; border-radius: 30px; box-shadow: 10px 10px 10px #888; background-image: url(../img/霍金3.jpg); background-size: 530px 310px; background-repeat: no-repeat; } .text { color:#FFFFFF; text-indent: 2em; line-height: 1.5em; font-size: 18px; } </style> </head> <body> <div> <h2 style="color:#DAA520;text-align: center;font-size:25px" onmouseover="change(this)" onmouseout="old(this)">霍金走了</h2> <p>甲: 你知道吗?霍金走了~~~</p> <p>乙: 什么?霍金能走了?他的腿治好了?</p> <p style="font-size: 20px;color:#FFD700 ">伟大的霍金先生,您一路走好,我们不会忘记您!</p> </div> <script type="text/javascript"> function change(element) { element.style.fontSize = '30px' element.style.color = '#FFD700' } function old(element) { element.style.fontSize = '25px' element.style.color = '#DAA520' } </script> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例