html给背景架渐变,JS和CSS实现渐变背景特效的代码
时间: 2024-03-07 19:49:18 浏览: 82
JS+CSS实现的漂亮渐变背景特效代码(6个渐变效果)
HTML 实现渐变背景:
```html
<body style="background: linear-gradient(to bottom right, #FFC0CB, #00FFFF);">
```
CSS 实现渐变背景:
```css
body {
background: linear-gradient(to bottom right, #FFC0CB, #00FFFF);
}
```
JS 实现渐变背景:
```javascript
var body = document.querySelector('body');
var gradient = 'linear-gradient(to bottom right, #FFC0CB, #00FFFF)';
body.style.background = gradient;
```
阅读全文