JQuery 设置CSS样式
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document
</title>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<div id="box">123
</div>
<script>
$('#box').css({
"color":"red","font-size":"20px","width":"200px","height":"200px",
"background-color":"gold","text-align":"center","line-height":"200px"
});
</script>
</body>
</html>
转载请注明原文地址:https://tech.qufami.com/read-6482.html