Border radius: 50% does not work | CSS/HTML/JS
P粉462328904
P粉462328904 2024-03-31 12:57:32
0
2
361

The point here is to set the div's position to the mouse as an additional effect, it should have a radius, but it doesn't work:

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

reply all(2)
P粉107991030

Change your CSS. Width: 6px; Width: 6px; Width: 6px; Height: 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

I'm assuming you're referring to the height of the second row here, which makes it a problem

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

So just change it to height:

#inner_circle{
width: 6px;
height: 6px;
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!