Why does the running order not follow the program?

<style>
.entered{font-size:36px;width:200px;height:100px;}
-sharptest{border:2px solid red;background:-sharpfdd;width:60px;height:60px;}
</style>

</head>
<body>
    <div id="test"></div>    
    <script>
        $("-sharptest").bind("mouseenter mouseout",function(event){
            $(this).toggleClass("entered");
            alert("(" + event.pageX + "," + event.pageY + ")");
        });    
    </script>

the simple jquery,
issu1
.notify {font-size:36px;width:200px;height:100px;}
font-size:36px; works, so why doesn"t width:200px;height:100px; work?
issue2
$(this) .toggleClass ("entered"); Why run after
alert ("mouse pointer over (" + event.pageX + "," + event.pageY + "));?
how to make $(this) .toggleClass ("entered"); after running, execute alert?

Apr.23,2021

issue1: css weight problem; id selector takes precedence over class selector;
issue2: toggleClass has been executed, but alert interrupts style redrawing;
you can use function, in toggleClass to print the log in function, and then you will find that the log is printed successfully, and then alert, and alert are closed before the style change takes effect

Menu