When it comes to achieving a certain functionality with HTML elements, using the "focus" property may not be the solution you're looking for. However, utilizing the "active" property can serve as a viable alternative. Most browsers interpret the "active" property as the equivalent of a "click" event, meaning that when you interact with an element by clicking on it, it is considered active.
To see this in action, take a look at the code snippet below. I've personally tested it on Chrome and confirmed that it behaves as expected. It also partially works on Internet Explorer, although additional styling is needed specifically for IE compatibility.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Title Goes Here</title>
<style>
body {background-color:lightgray}
h1 {color:blue}
p {color:green}
.div1 {
border: 1px solid green;
}
.div1:active .dropdown {
display: none;
}
.dropdown:active {
display: none;
}
</style>
</head>
<body>
<p>This is my web page</p>
<div class="div1">
test
<ul class="dropdown">
<li>example</li>
</ul>
<div>
</body>
</html>