边框半径:50% 不起作用 | CSS/HTML/JS
P粉462328904
P粉462328904 2024-03-31 12:57:32
0
2
395

这里的要点是将div的位置设置为鼠标作为附加效果,它应该有一个半径,但它不起作用:

let inner_circle = document.getElementById("inner_circle");

window.addEventListener("mousemove", function(mouse) {
  inner_circle.style.transform = `translate(${mouse.clientX}px, ${mouse.clientY}px)`; // sets the position of the inner circle to the mouse
});
#inner_circle{
    margin-left: -3px;
    margin-top: -3px;
    position: fixed;
    top: 0;
    left: 0;
    border: 1px solid #703be7;
    border-radius: 50%; //<- doesn't work
    font-size: 1px;
    background-color: #703be7;
    width: 6px;
    width: 6px;
    z-index: 1000001;
    pointer-events: none;
}
<div id="inner_circle"></div>

P粉462328904
P粉462328904

全部回复(2)
P粉107991030

更改你的 CSS。宽度:6 像素;宽度:6 像素;宽度:6px;高度:6px;

let inner_circle = document.getElementById("inner_circle");

window.addEventListener("mousemove", function(mouse) {
  inner_circle.style.transform = `translate(${mouse.clientX}px, ${mouse.clientY}px)`; // sets the position of the inner circle to the mouse
});
#inner_circle{
    margin-left: -3px;
    margin-top: -3px;
    position: fixed;
    top: 0;
    left: 0;
    border: 1px solid #703be7;
    border-radius: 50%; //
sssccc
P粉125450549

我假设你指的是这里第二行的高度,这使得它成为一个问题

#inner_circle{
width: 6px;
width: 6px;
}

所以只需将其更改为高度:

#inner_circle{
width: 6px;
height: 6px;
}
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!