PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, March 12, 2022

[FIXED] Responsive nav bar for all screens

 March 12, 2022     css, html, wordpress     No comments   

Issue

I am developing a WordPress website. I already edited the navbar and added some custom CSS. I will include my custom CSS below.

/** Header Customization start **/

@media screen and (min-width:1024px){ .header_area_container{
    background:white;
} 

 .wgl-header-row_wrapper{
    background:white;
} 

.menu-item-1782{
    background:#35a07b;
    margin-left: 250px;
    border-left: 1px solid white;
  height: 500px;
}

.menu-item-1810{
    background:#35a07b;
    border-left: 1px solid white;
  height: 500px;
}

.menu-item-1784{
    background:#35a07b;
    border-left: 1px solid white;
  height: 500px;
}

.menu-item-1805{
    background:#35a07b;
    border-left: 1px solid white;
  height: 500px;
}

.menu-item-1832{
    background:#35a07b;
    border-left: 1px solid white;
  height: 500px;
}

.menu-item-1826{
    background:#35a07b;
    border-left: 1px solid white;
  height: 500px;
}

.side_panel .side_panel_inner .side_panel-toggle{
/*  color:black; */
    margin-top:400px;

}

#menu-main-1{
    margin-left:140px
}


}
/** Header Customization end **/

The problem with this CSS is I have to adjust the width of the header for separate screen versions manually and that's not a good industry standard. How can I make this responsive? I want to align my menu tabs automatically for all the desktop/laptop screen sizes.


Solution

@media screen and (min-width:1024px){ .header_area_container{
    background:purple;
} 

 .wgl-header-row_wrapper{
    background:white;
} 

.menu-item-1782{
    background:#35a07b;
    margin-left: 250px;
    border-left: 1px solid white;
  height: 500px;
}

.menu-item-1810{
    background:#35a07b;
    border-left: 1px solid white;
  height: 500px;
}

.menu-item-1784{
    background:#35a07b;
    border-left: 1px solid white;
  height: 500px;
}

.menu-item-1805{
    background:#35a07b;
    border-left: 1px solid white;
  height: 500px;
}

.menu-item-1832{
    background:#35a07b;
    border-left: 1px solid white;
  height: 500px;
}

.menu-item-1826{
    background:#35a07b;
    border-left: 1px solid white;
  height: 500px;
}

.side_panel .side_panel_inner .side_panel-toggle{
 color:black; 
    margin-top:400px;

}

#menu-main-1{
    margin-left:140px
}


}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./index.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
        <a class="navbar-brand" href="#">Navbar</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>
      
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
          <ul class="navbar-nav mr-auto">
            <li class="nav-item active">
              <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="#">Link</a>
            </li>
            <li class="nav-item dropdown">
              <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                Dropdown
              </a>
              <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                <a class="dropdown-item" href="#">Action</a>
                <a class="dropdown-item" href="#">Another action</a>
                <div class="dropdown-divider"></div>
                <a class="dropdown-item" href="#">Something else here</a>
              </div>
            </li>
            <li class="nav-item">
              <a class="nav-link disabled" href="#">Disabled</a>
            </li>
          </ul>
          <form class="form-inline my-2 my-lg-0">
            <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
            <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
          </form>
        </div>
      </nav>
      <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>



Answered By - user17242934
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing