<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title></title> <style> .box { display: flex; width: 300px; border: 1px solid red; justify-content: space-evenly; } .item { position: relative; border: 1px solid blue; } .item>div { height: 30px; line-height: 30px; } ul { list-style: none; position: absolute; display: none; padding: 0; margin: 0; width: 100px; border: 1px solid green; top: 30px; left: calc((100% - 100px) / 2); } li { padding: 0; margin: 0; } .item:hover>div+ul { background-color: red; display: block; } </style> </head> <body> <div class="box"> <div class="item"> <div>menuitem1</div> <ul> <li>item1</li> <li>item2</li> <li>item3</li> </ul> </div> <div class="item"> <div>menuitem1</div> <ul> <li>item1</li> <li>item2</li> <li>item3</li> </ul> </div> </div> </body> </html>