html - 使链接适合导航栏
问题描述
所以我正在制作一个网站,我已经制作了一个导航栏并将链接放入其中但是链接没有填满栏我如何确保链接填满整个栏?因为它们实际上适合我制作的酒吧,并且不要让酒吧继续前进或留在左边。
任何帮助将非常感激
谢谢你
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
.logo{
width: 100px;
height: 70px;
background: pink;
}
.left{
width: 100px;
height: 50px;
background: transparent;
float: left;
}
.right{
float: right;
width: 100px;
height: 50px;
background: transparent;
}
.topnav {
overflow: hidden;
background-color: blue;
text-align: center;
position: relative;
}
.topnav a {
float: left;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
.topnav a:hover {
background-color: #ddd;
color: black;
}
.topnav a.active {
background-color: #4CAF50;
color: white;
}
<html>
<head>
</head>
<body>
<div>
<ul>
<div class="logo"></div>
<div class="left"></div>
<div class="right"></div>
<div class="topnav">
<a href="vvcb">HOME</a>
<a href="#news">blalala</a>
<a href="#contact">HELP</a>
<a href="#about">ABOUT</a>
<a href="#about">LOGIN</a>
<a href="#about">REGISTER</a>
</div>
</ul>
</div>
</body>
</html>
解决方案
使用 CSS Flexbox,这是一个很好的入门:https ://css-tricks.com/snippets/css/a-guide-to-flexbox/
推荐阅读
- c# - 如何获取 html 输入按钮以正确显示 resource.resx 键/值条目?
- java - 显式类型转换,派生类数组
- parsing - 有没有办法在 python 中解析一个 .txt 文件,让用户给出一个词来解析?
- python - 如何从熊猫数据框列中删除字符串值?
- sql - pandas read_sql 将 NULL 导入为 0
- r - 为什么在 ggplot2 中运行相同的注释函数对其他人有用但对我抛出错误(审美长度)?
- netsuite - 在 NetSuite 保存的搜索中提取子字符串
- php - 今年每月的查询计数 - Laravel 5.8
- sql-server - 将 XML 元素转换为 T-SQL 中的属性
- python - 在 Django 中,为什么反向函数将元组作为参数传递?