Home > Enterprise >  menu items on the navigation bar and company icon on the left side of the nav bar
menu items on the navigation bar and company icon on the left side of the nav bar

Time:11-18

I have the following code on my web page:

<nav class="navbar" style="background-color: #264653; position:absolute; top:0px; left:50%; transform:translateX(-50%); width:100%; ">
  <div class="container-fluid">
    <span class="navbar-brand" style="display:flex;">
        
            <img  src="~/Images/InfoOrange.png" alt="ACR" width="80" height="80" class="d-inline-block align-middle mr-2" runat="server" />
 
       <span style="font-size:25px;color:white;"><span style="color:#e9c46a">Test City</span><br />Test Company</span>

    </span>
     
       <div id="navbarSupportedContent" class="collapse navbar-collapse">
      <ul class="navbar-nav ml-auto">
       <%-- <li class="nav-item active"><a href="#" class="nav-link">Home <span class="sr-only">(current)</span></a></li>--%>
        <li class="nav-item dropdown nav-item active">
        <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Users
        </a>
        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
          <a class="dropdown-item" href="#">Details</a>
          <a class="dropdown-item" href="Depatment.aspx">Department</a>
     
         <%-- <a class="dropdown-item" href="#">Sections</a>--%>
        </div>
      </li>
          <li>&nbsp;</li>

              <li class="nav-item dropdown nav-item active">
        <a class="nav-link dropdown-toggle" href="#" id="admindropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Admin
        </a>
        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
          <a class="dropdown-item" href="NewBoxFolder.aspx">Box/Folder</a>
          <a class="dropdown-item" href="#">Configuration</a>

        </div>
      </li>
           <li>&nbsp;</li>
               <li class="nav-item dropdown nav-item active">
        <a class="nav-link dropdown-toggle" href="#" id="recordsDropDown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Records
        </a>
        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
          <a class="dropdown-item" href="FileUpload.aspx">BlockChain Upload</a>
          <a class="dropdown-item" href="#">Verify</a>
          <a class="dropdown-item" href="DocReport.aspx">Report</a>
            <a class="dropdown-item" href="BucketList.aspx">S3 List</a>
        </div>
      </li>

      </ul>
    </div>
          
  </div>
</nav>

when I see the navbar and the menu items on the web page. They look like this:

enter image description here

I want to bring the logo and the company name to the left side of the navbar and menu items on the right side of the menu bar and I want the menu items to be seen horizontally rather than vertically. I am not sure what am I doing wrong.

Any help will be highly appreciated.

CodePudding user response:

Make sure you click full-page when viewing the snippet. Everything should be positioned how you want but didn't want to mess around with your drop-down menu items because I assume you have js or something for those. You can put media-queries on to adjust the responsiveness of the browser.

ul {
  display: flex;
  position: absolute;
  top: 0;
  right: 0;
}
<nav class="navbar" style="background-color: #264653; position:absolute; top:0px; left:50%; transform:translateX(-50%); width:100%; ">
  <div class="container-fluid">
    <span class="navbar-brand" style="display:flex;">
        
            <img  src="~/Images/InfoOrange.png" alt="ACR" width="80" height="80" class="d-inline-block align-middle mr-2" runat="server" />
 
       <span style="font-size:25px;color:white;"><span style="color:#e9c46a">Test City</span><br />Test Company</span>

    </span>
     
       <div id="navbarSupportedContent" class="collapse navbar-collapse">
      <ul class="navbar-nav ml-auto">
       <!-- <li hljs-tag"><a href="#" class="nav-link">Home <span class="sr-only">(current)</span></a>
        <li class="nav-item dropdown nav-item active">
        <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Users
        </a>
        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
          <a class="dropdown-item" href="#">Details</a>
          <a class="dropdown-item" href="Depatment.aspx">Department</a>
     
         <!-- <a  href="#">Sections</a>-->
        </div>
      </li>
          <li>&nbsp;</li>

              <li class="nav-item dropdown nav-item active">
        <a class="nav-link dropdown-toggle" href="#" id="admindropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Admin
        </a>
        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
          <a class="dropdown-item" href="NewBoxFolder.aspx">Box/Folder</a>
          <a class="dropdown-item" href="#">Configuration</a>

        </div>
      </li>
           <li>&nbsp;</li>
               <li class="nav-item dropdown nav-item active">
        <a class="nav-link dropdown-toggle" href="#" id="recordsDropDown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Records
        </a>
        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
          <a class="dropdown-item" href="FileUpload.aspx">BlockChain Upload</a>
          <a class="dropdown-item" href="#">Verify</a>
          <a class="dropdown-item" href="DocReport.aspx">Report</a>
            <a class="dropdown-item" href="BucketList.aspx">S3 List</a>
        </div>
      </li>

      </ul>
    </div>
          
  </div>
</nav>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

  • Related