<!DOCTYPE html>
<html>
<head>
<style>
ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #333;
}
li {
  float: right;
}
li a {
  display: block;
  color: white;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
}
li a:hover {
  background-color: #111;
}
</style>
</head>
<body>
<ul>
  <li><a href="#home">خانه</a></li>
  <li><a href="#news">اخبار</a></li>
  <li><a href="#contact">ارتباط با ما</a></li>
  <li><a href="#about">درباره ما</a></li>
</ul>
</body>
</html>overflow چرا اینجا مهمه؟؟
visible یا auto میذاری چرا درست اجرا نمیشه؟
بهتره استایل خودتونو اینجوری اعمال کنید و بیشتر از flex و grid استفاده کنید به جای float.
<style>
ul {
  display: flex;
  flex-direction: row-reverse;
  margin : 0;
  padding : 1rem;
  background-color: #333;
  list-style-type: none;
}
li a {
  color: white;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
}
li a:hover {
  background-color: #111;
}
</style>آیا مایل به ارسال نوتیفیکیشن و اخبار از طرف راکت هستید ؟