<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> .box { width: 20px;height: 20px; } </style> </head> <body> <div class="box"></div> <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script> <script> $('.box').css('border','1px solid red'); // 接受两个参数,要设置的样式和样式的值 // 只能这样设置一种样式 // 但是也可以有别的方式设置多个样式 $('.box').css({ bcakgroundColor : 'red', width : '100px' }); </script> </body> </html>
jq css()
猜你喜欢
转载自www.cnblogs.com/sandraryan/p/11526576.html
今日推荐
周排行