I have a navigation bar which I want to make responsive. I'm using the CSS 'col-container' and 'colom' to make my website responsive, so I wanted to try and integrate that into my navigation bar. I have 4 tabs so 4 times 'col-3' (= 12 cols = 100%) but I still have the '.icon' which makes the 4 'col-3' go over the 'col-12'. Does anyone know how to make the 4 tabs equal and responsive (so no 'width; ...px;'). Thx!
.topnav {
overflow: hidden;
background-color: #333;
}
.topnav a {
float: left;
display: block;
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: #04AA6D;
color: white;
}
.topnav .icon {
display: none;
}
@media screen and (max-width: 600px) {
.topnav a:not(:first-child) {display: none;}
.topnav a.icon {
float: right;
display: block;
}
}
@media screen and (max-width: 600px) {
.topnav.responsive {position: relative;}
.topnav.responsive .icon {
position: absolute;
right: 0;
top: 0;
}
.topnav.responsive a {
float: none;
display: block;
text-align: left;
}
}
</style>
</head>
<body>
<div class="topnav" id="myTopnav">
<div class="col-container col-10"
<a href="#home" class="active colom col-3">Home</a>
<a href="#drone" class="colom col-3">Drone</a>
<a href="#pictures" class="colom col-3">Pictures</a>
<a href="#videos" class="colom col-3">Videos</a>
<a href="javascript:void(0);" class="icon" onclick="myFunction()">
<i class="fa fa-bars"></i>
</a>
</div>
</div>
<script>
function myFunction() {
var x = document.getElementById("myTopnav");
if (x.className === "topnav") {
x.className += " responsive";
} else {
x.className = "topnav";
}
}
</script>