Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

More than one fas fa-bar

benmorrison_1

New Coder
I have tried adding a fas fa-bar, the one I added on the navigation bar is set up to appear at a smaller resolution however, more than one fas fa-bar icon has appeared and I can't figure out why please help.
I have included the css and html code thanks in advance!
CSS:
/* Reset some default styles */
body, ul {
    margin: 0;
    padding: 0;
}

/* Navigation bar styles */
.nav2 {
    background-color: #48abe0;
    box-shadow: 1 2px 5px rgba(0, 0, 0, 0.2);
    border-bottom: 3px solid #fff;
    box-shadow: 0 0 50px #48abe0;
}

.nav-item a {
    text-decoration: none;
    color: #fff;
    font-size: 25px;
    position: relative;
    transition: color 0.3s;
}
label.logo{
    color: white;
    font-size: 35px;
    line-height:80px;
    padding: 0 50px;
    font-weight: bold;
}

nav ul{
    float: right;
    margin-right: 20px;
}
nav ul li{
    display: inline-block;
    line-height: 80px;
    margin: 0 5px;
}
nav ul li a{
    color: #ffffff;
    text-transform: uppercase;
    padding: 7px 13px;
    border-radius: 3xp;
}



/* Neon bar glow effect on hover */

.nav-item a::before {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #ffffff; /* Neon green color */
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: opacity 0.3s, transform 0.3s;
}

.nav-item a:hover::before {
    opacity: 1;
    transform: scaleX(1);
}
.nav-item.clicked {
    transform: translateX(10px);
}

.checkbtn{
    font-size: 30px;
    color: white;
    float: right;
    line-height: 80px;
    margin-right: 40px;
    cursor: pointer;
    display: none;
}

#check{
    display: none;
}

@media (max-width: 952px){
    label.logo{
        font-size: 25px;
        padding-left: 50px;
}
    nav ul li a {
        font-size: 25px;
    }
}
@media (max-width: 858px){
    .checkbtn{
        display: block;
}
CSS:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
  body {
    margin: 0;
    padding: 0;
    background: url('') center/cover no-repeat fixed;
    opacity: 1;
  }
</style>

<title>TemplateX</title>
  <link rel="stylesheet" href="nav.css">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="styles.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
</head>

<body>
    <nav class="nav2">
        <input type="checkbox" id="check">
            <label for="check" class="checkbtn">
                <i class ="fas fa-bars"><i/>
                </label>
                <label class ="logo">Template-X</label>
        <ul>
            <li class="nav-item"><a href="#">Home</a></li>
            <li class="nav-item"><a href="#">About</a></li>
            <li class="nav-item"><a href="#">Services</a></li>
            <li class="nav-item"><a href="#">Portfolio</a></li>
            <li class="nav-item"><a href="#">Contact</a></li>
        </ul>
    </nav>
</body>
</html>
 
Hey, Welcome to Code Forum!

I believe you're seeing multiple icons due to a misplaced closing slash. The closing tag of the icon is in the wrong place.

See the example down below.

Example:
HTML:
<i class ="fas fa-bars"><i/>

It should be like this:
HTML:
<i class ="fas fa-bars"></i>
 

Buy us a coffee!

Buy me a coffee.
Back
Top Bottom