.nav {
  display: flex;
  justify-content: space-between; /* 左右两个按钮分别靠左右对齐 */
  align-items: center; /* 垂直居中 */
  padding: 0 10px; /* 左右各留出10px空白 */
  height: 40px; /* 导航栏高度 */
  background-color: #f5f5f5; /* 导航栏背景色 */
}

.left-btn, .right-btn {
  width: 20px; /* 按钮宽度 */
  height: 20px; /* 按钮高度 */
  background-color: #ccc; /* 按钮背景色 */
}

.title {
  flex: 1; /* 中间标题占据剩余空间 */
  text-align: center; /* 居中对齐 */
}
Vue.js 无需定位实现 400px 导航栏按钮边距 10px 和居中标题

原文地址: http://www.cveoy.top/t/topic/n30h 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录