
HTML
TianNicholas
一路走来,雕刻时光,记录点滴。
合作可 email - cheungdennis@foxmail.com
展开
-
js获取元素与当前可视区域顶部的距离
var box=document.getElementById(‘box’); // 获取元素alert(box.getBoundingClientRect().top); // 元素上边距离页面上边的距离alert(box.getBoundingClientRect().right); // 元素右边距离页面左边的距离alert(box.getBoundingClientRect().bottom); // 元素下边距离页面上边的距离alert(box.getBoundingClient.原创 2022-05-16 11:12:18 · 8900 阅读 · 0 评论 -
css伪类实现行号自动增加
样式代码如下pre { background: #303030; color: #f1f1f1; padding: 10px 16px; border-radius: 2px; border-top: 4px solid #00aeef; -moz-box-shadow: inset 0 0 10px #000; box-shadow: inset 0 0 10px #000; counter-reset: line;}pre span {.原创 2021-03-03 11:38:27 · 845 阅读 · 1 评论