Disabilitare un link da foglio di stile (CSS)

← CSS

fonte https://www.tutorialrepublic.com/faq/how-to-disable-a-link-using-only-css.php#:~:text=Answer%3A%20Use%20the%20CSS%20pointer,the%20target%20of%20pointer%20events

E' sufficiente disabilitare gli eventi sul componente con il comando:

pointer-events: none;

Esempio: classe da assegnare al link per disabilitarlo

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Disable an HTML Link using CSS</title>
<style>
    .disabled-link{
        cursor: default;
        pointer-events: none;        
        text-decoration: none;
        color: grey;
    }
</style>
</head>
<body>
    <a href="somepage.html" class="disabled-link">HTML Link</a>
</body>
</html>