将这段代码改为jQuery代码 <style type="text/css"> h1 { text-align: center; font-size: 40px; font-family:"楷体"; text-shadow: 5px 5px 5px #000000; } p { font-family: verdana; font-size: 20px; text-indent: 330px; font-family:"仿宋"; } .row p { display: inline-block; width: 4em; text-align: justify; text-align-last: justify; } body { font-family: "Lato", sans-serif,background="12(1).jpg"; } .sidenav { height: 100%; width: 0; position: fixed; z-index: 1; top: 0; left: 0; background-color: #111; overflow-x: hidden; transition: 0.5s; padding-top: 60px; } .sidenav a { padding: 8px 8px 8px 32px; text-decoration: none; font-size: 25px; color: #818181; display: block; transition: 0.3s; } .sidenav a:hover, .offcanvas a:focus{ color: #f1f1f1; } .sidenav .closebtn { position: absolute; top: 0; right: 25px; font-size: 36px; margin-left: 50px; } #main { transition: margin-left .5s; padding: 16px; } @media screen and (max-height: 450px) { .sidenav {padding-top: 15px;} .sidenav a {font-size: 18px;} } img{ width:30px; height:40px; } </style>
时间: 2024-02-15 13:27:55 浏览: 35
$('head').append('<style type="text/css">h1{text-align:center;font-size:40px;font-family:"楷体";text-shadow:5px 5px 5px #000000;}p{font-family:verdana;font-size:20px;text-indent:330px;font-family:"仿宋";}.row p{display:inline-block;width:4em;text-align:justify;text-align-last:justify;}body{font-family:"Lato",sans-serif,background="12(1).jpg";} .sidenav{height:100%;width:0;position:fixed;z-index:1;top:0;left:0;background-color:#111;overflow-x:hidden;transition:0.5s;padding-top:60px;}.sidenav a{padding:8px 8px 8px 32px;text-decoration:none;font-size:25px;color:#818181;display:block;transition:0.3s;}.sidenav a:hover,.offcanvas a:focus{color:#f1f1f1;}.sidenav .closebtn{position:absolute;top:0;right:25px;font-size:36px;margin-left:50px;}#main{transition:margin-left .5s;padding:16px;}@media screen and (max-height:450px){.sidenav{padding-top:15px;}.sidenav a{font-size:18px;}}img{width:30px;height:40px;}</style>');
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
<!DOCTYPE html> <html> <head> <title>我的网页</title> <meta charset="UTF-8"> <style> /* CSS 样式表 */ body { margin: 0; background-color: #f2f2f2; font-family: Arial, sans-serif; } header { background-color: #333; color: white; padding: 20px; text-align: center; font-size: 24px; } nav { background-color: #f1f1f1; text-align: center; padding: 10px; margin-bottom: 20px; } nav a { display: inline-block; color: #333; text-align: center; padding: 14px 16px; text-decoration: none; font-size: 18px; font-weight: bold; } nav a:hover { background-color: #ddd; color: black; } section { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; margin: 20px; } section img { max-width: 100%; height: auto; margin: 10px; box-shadow: 0 0 5px #ccc; } section p { font-size: 18px; line-height: 1.5; text-align: center; margin: 10px; } /* JavaScript */ section img:hover { transform: scale(1.1); box-shadow: 0 0 10px #ccc; } /* jQuery */ $(document).ready(function(){ $("nav a").click(function(){ $(this).addClass("active").siblings().removeClass("active"); }); }); </style> <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script> <script> /* JavaScript */ function showMsg() { alert("欢迎来到我的网页!"); } </script> </head> <body> 欢迎来到我的网页 首页 关于我们 联系我们
这是一张美丽的图片
这是另一张美丽的图片
这是第三张美丽的图片 <script> /* JavaScript */ showMsg(); </script> </body> </html>
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)