css 元素设置了10em和transition,进入后应该有放大效果么?-灵析社区

无敌奥特MEN

[https://www.youtube.com/watch?v=G685JsiQM3E](https://link.segmentfault.com/?enc=SWiPgJ9WrGY1Bi0swdhmcQ%3D%3D.r5iibvtuf2kssMS6DbmeiCQodFl6U5s0F7GRe%2FcyJ8ytOtOmGkbgajl4yDqPHJwu) 这个视频里设置后载入页面就有放大效果.但我这边试了半没有这个效果.差在哪里?mac和windows? Hello .box { font-size: 10em; transition: 2s; }

阅读量:12

点赞量:0

问AI
你像他那样,把 CSS 写到单独的文件里面,然后使用 link 标签引入,就可以复现了。 *** 另外发现,直接在页面写 style 标签的话,只要触发了对应的样式计算(Recalculate Style),也是可以的。 Hello const el = document.querySelector('.box'); // 1 getComputedStyle(el).fontSize; // 2 console.log(el.style.fontSize); // 3 console.log(el.offsetHeight); .box { font-size: 10em; transition: 2s; }