基本方法: 使用document.getElementById等方法获取到DOM元素, 然后直接设置其CSS样式: let Box = document.getElementById(‘root’); Box.style.background=“red”; 注意点: JS中不能直接使用float, 而需要使用styleFloat