Lately, I've been diving into building a new website. It's still in its early stages and unfortunately, I'm struggling to get the style.css file to cooperate. Despite my best efforts scouring the internet for fixes, I haven't had much luck. To cut to the chase, here's a snippet from my index.html code:
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" media="screen"/>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/
fontawesome/4.7.0/css/fontawesome.min.css">
</head>
<body>
<!-- Load an icon library -->
<div class="navbar">
<a class="active" href="#"><i class="fa fa-fw fa-home"></i> Home</a>
<a href="#"><i class="fa fa-fw fa-search"></i> Search</a>
<a href="#"><i class="fa fa-fw fa-envelope"></i> Contact</a>
<a href="#"><i class="fa fa-fw fa-user"></i> Login</a>
</div>
Upon visiting my website (halifaxdevelopers.dx.am), I noticed through Inspect Element that some elements were shifted into my <body>
for reasons unknown.
On a related note, here's a glimpse of my style.css file:
/* Style the navigation bar */
.navbar {
width: 100%;
background-color: #555;
overflow: auto;
}
/* Navbar links */
.navbar a {
float: left;
text-align: center;
padding: 12px;
color: white;
text-decoration: none;
font-size: 17px;
}
/* Navbar links on mouse-over */
.navbar a:hover {
background-color: #000;
}
/* Current/active navbar link */
.active {
background-color: #4CAF50;
}
/* Add responsiveness - will automatically display the navbar vertically
instead of horizontally on screens less than 500 pixels */
@media screen and (max-width: 500px) {
.navbar a {
float: none;
display: block;
}
}
| Hopefully someone out there can shed some light on this situation.