This is my first time attempting to use a custom font using CSS. I can’t figure out why my linked font is not appearing in the navigation bar of webpage. I am sorry if this seems like a dumb question although I am completely new to all of this and I am trying to revamp my website for FBLA Nationals at the end of the month. I will probably will have several more questions so if there is someone that is experienced and willing to communicate back and forth with me I would greatly appreciate it.
I have made sure the file path is right, in VSC it follows the link so I know that part is good.
this is my CSS:
* {
margin: 0;
padding: 0;
}
@font-face {
font-family: 'Font1';
src: url(Fonts/Font1.ttf) format('truetype');
}
body {
min-height: 100vh;
background-color: #f1c65a;
font-family: 'Font1', sans-serif; /* Include fallback font */
display: flex;
flex-direction: column;
}
nav {
background-color: rgba(255, 255, 255, 0.01);
position: fixed;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
z-index: 2; /* Ensure nav stays above other elements */
font-size: 30px;
font-family: 'Font1', sans-serif; /* Include fallback font */
}
nav ul {
list-style: none;
display: flex;
align-items: center;
padding: 0 20px;
}
nav .main-nav {
display: flex;
justify-content: space-between;
width: 100%;
}
nav .main-nav li {
margin: 0 10px;
}
nav a {
height: 50px;
display: flex;
align-items: center;
text-decoration: none;
color: #023020;
}
nav a:hover {
background-color: #f0f0f0;
}
.logo-container {
width: 220px; /* Set the width of the logo container */
height: auto; /* Allow the height to adjust proportionally */
}
.logo-container img {
max-width: 100%; /* Make sure the logo doesn't exceed the container width */
height: auto; /* Allow the height to adjust proportionally */
margin-top: 135px;
}
.sidebar {
position: fixed;
top: 0;
right: 0;
height: 100vh;
width: 250px;
background-color: rgba(255, 255, 255, 0.01);
backdrop-filter: blur(12px);
box-shadow: -10px 0 10px rgba(0, 0, 0, 0.01);
display: none;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
z-index: 1; /* Ensure sidebar stays above other elements */
}
.sidebar li {
width: 100%;
}
.sidebar a {
width: 100%;
padding: 15px 30px;
}
.menu-button {
display: none;
}
.menu-button ul {
list-style: none;
margin: 0;
padding: 0;
}
.menu-button li {
margin: 0;
padding: 0;
}
.menu-button a {
display: flex;
align-items: center;
text-decoration: none;
color: #023020;
height: 50px;
}
.menu-button a:hover {
background-color: #f0f0f0;
}
footer {
display: flex;
justify-content: center;
align-items: center;
position: fixed;
bottom: 0;
width: calc(100% - 40px); /* Subtract the total padding from the width */
left: 49%; /* Position the footer to the center horizontally */
transform: translateX(-50%); /* Center the footer precisely */
background-color: #f1c65a;
color: #023020;
width: 100%;
z-index: 1;
}
.footer-item {
text-align: center;
font-size: 30px;
}
footer a {
text-decoration: none;
color: #023020;
}
footer a:hover {
background-color: #7B3F00;
color: #023020;
}
@media (max-width: 800px) {
.hideOnMobile {
display: none !important;
}
.menu-button {
display: block;
}
nav .main-nav {
justify-content: center; /* Align items to the right */
}
.logo-container img {
margin-top: 50px;
margin-left: 80px; /* Push the logo to the right */
width: 120px; /* Set the width of the logo container */
height: auto; /* Allow the height to adjust proportionally */
}
}
@media (max-width: 400px) {
.sidebar {
width: 100%;
}
}
Gavin Knotts is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.