JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Imasen Test</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<!-- header -->
<section class="header">
<nav>
<a href=""><img src="../test/img/logo.svg" width="213" height="42"></a>
<div class="nav-links">
<ul>
<li><a href="">หน้าหลัก</a></li>
<li><a href="">เกี่ยวกับเรา</a>
<div class="dropdown-menu">
<ul>
<li><a href="">Page 1</a></li>
<li><a href="">Page 2</a></li>
<li><a href="">Page 3</a></li>
</ul>
</div>
</li>
<li><a href="">ผลิตภัณฑ์</a></li>
<li><a href="">กิจกรรมเพื่อสังคม</a></li>
<li><a href="">นักลงทุน</a></li>
<li><a href="">ติดต่อเรา</a></li>
</ul>
</div>
</nav>
</section>
</body>
</html>
CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.header {
min-height: 100vh;
width: 100%;
background-image: linear-gradient(rgba(4, 9, 30, 0.5), rgba(4, 9, 30, 0.5)), url("../img/heehehehehe.jpg");
background-position: center;
background-size: cover;
position: relative;
}
nav {
display: flex;
padding: 2% 3%;
justify-content: space-between;
align-items: center;
}
.nav-links {
flex: 1;
text-align: center;
font-size: 18px;
font-weight: bold;
}
.nav-links ul li {
list-style: none;
display: inline-block;
position: relative;
padding-bottom: 0.5rem;
}
.nav-links ul li a {
color: #fff;
text-decoration: none;
}
.nav-links ul li::after {
content: '';
position: absolute;
width: 0;
height: 2px;
background: #fff;
right: 0;
bottom: 0;
transition: width 0.25s ease-out;
}
.nav-links ul li:hover::after {
width: 100%;
left: 0;
right: auto;
}
.dropdown-menu {
display: none;
}
.nav-links ul li:hover .dropdown-menu {
display: block;
position: absolute;
left: 0;
top: 100%;
background: linear-gradient(rgba(1, 1, 1, 0.4), rgba(1, 1, 1, 0.4));
}
.dropdown-menu ul {
display: block;
margin: 10px;
}
.dropdown-menu ul li {
width: 150px;
padding: 10px;
text-align: left;
}