Creating an unordered list (ul) with list items (li) that extend the full width

Having trouble making my list items (li) from the unordered list (ul) stretch across the page like the navigation bars on websites such as Verragio and James Allen. Can someone assist me with this? Here is a basic example of a nav hover bar.

.dropdown-btn {
  width: 100%;
  height: 50px;
  background: white;
  line-height: 50px;
  display: none;
}

nav {
  width: 100%;
  height: 50px;
  background-color: #d60d8c;
  margin-bottom: 1px;
  position: sticky;
  top: 0;
  padding: 0px 0px;
  border: none;
}

ul {
  text-indent: 0px;
}

nav:hover {
  height: 50px;
}

.navbar-tab {
  display: block;
}

.hover-list {
  position: absolute;
}

.navbar-tab-1 {
  background: #d60d8c;
  float: left;
  border: none;
}

.navbar-tab-1+.navbar-tab-1 {
  border-bottom: none;
}

.hover-list {
  border-top: black 3px solid;
}

.navbar-tab {
  padding-left: 20px;
  display: block;
}

.navbar-tab {
  max-width: 1240px;
}

.navbar-tab-1 {
  padding-right: 68px;
  width: auto;
}

.hover-list li {
  background-color: #e2e2e2;
  border-bottom: 1px white solid;
  font-size: 15px;
  text-indent: 20px;
  height: 35px;
  line-height: 35px;
  width: 100vw;
  border-top: none;
  float: left;
}

ul li ul li {
  display: block;
}

ul li {
  font-size: 19px;
}

ul {
  padding: 0px;
  list-style: none;
  font-family: arial;
  margin: auto;
}

.navbar-tab-1:hover {
  color: black;
  transition-duration: .2s;
}

ul li {
  font-family: 'Raleway', sans-serif;
  font-weight: 400;
  line-height: 50px;
  list-style: none;
}

ul li a {
  text-decoration: none;
  color: black;
}

ul li ul li{
  display: none;
}
.hover-list li:hover {
  background-color: #f5f5f0;
  transition-duration: .2s;
}
<nav id="navbar">
  <div class="dropdown-btn">Go To...</div>
  <ul class="navbar-tab">
    <li class="navbar-tab-1 selected"><a href="#">Test1</a></li>
    <li class="navbar-tab-1 select">
      <a href="#">Test2</a>
      <ul class="hover-list select">
          <li><a href="#">Item1</a></li>
      </ul>
    </li>
  </ul>
</nav>

Answer №1

Perhaps this is what you are seeking

body {
  margin:0;
}

.dropdown-btn {
  width: 100%;
  height: 50px;
  background: white;
  line-height: 50px;
  display: none;
}

nav {
  width: 100%;
  height: 50px;
  background-color: #d60d8c;
  margin-bottom: 1px;
  position: sticky;
  top: 0;
  padding: 0px 0px;
  border: none;
}

ul {
  padding-left: 0;
  position: relative;
  list-style: none;
  margin-bottom: 0;
}

nav:hover {
  height: 50px;
}

.navbar-tab {
  display: block;
}

.hover-list {
  position: fixed;
  max-height: 0;
  transition: max-height 1s;
  padding: 0;
  width: 100vw;
  overflow: hidden;
  left: 0;
  top: 66px;
}

.hover-list > li {
  width: 100%;
}

.navbar-tab-1 {
  background: #d60d8c;
  float: left;
  border: none;
}

.navbar-tab-1+.navbar-tab-1 {
  border-bottom: none;
}

.navbar-tab {
  padding-left: 20px;
  display: block;
}

.navbar-tab {
  max-width: 1240px;
}

.navbar-tab-1 {
  padding-right: 68px;
  width: auto;
}

.hover-list li {
  background-color: #e2e2e2;
  border-bottom: 1px white solid;
  font-size: 15px;
  text-indent: 20px;
  height: 35px;
  line-height: 35px;
  border-top: none;
  float: left;
}

ul li ul li {
  display: block;
}

ul li {
  font-size: 19px;
}

ul > li:hover ul {
  max-height: 500px;
}
<nav id="navbar">
  <div class="dropdown-btn">Go To...</div>
  <ul class="navbar-tab">
    <li class="navbar-tab-1 selected">Test1</li>
    <li class="navbar-tab-1 select">Test2
      <ul class="hover-list select">
          <li><a>Item1</a></li>
      </ul>
    </li>
  </ul>
</nav>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to align an image to flex-end?

I recently started using React and ran into issues trying to align my image using CSS. Despite trying various methods like justifyContent, justifySelf, and floating right, I couldn't get the image to align on the right side of the screen without resor ...

Ways to create a clickable anchor tag without using any text

I am currently designing my own website and incorporating links to various social media platforms using icons. However, I am facing an issue where the links are not clickable. For a detailed look at my problem, you can refer to this JSFiddle: http://jsfid ...

What is the process for moving entered data from one text box to another text box when a checkbox is selected?

I need help with a function that reflects data entered in one text box to another text box when a checkbox is ticked. The checkbox is initially checked and the values should change when it is unchecked and then checked again. Currently, the code is only ou ...

Initiating a video by floating over a container

This code snippet allows me to trigger videos to play when hovered over individually: //play video on hover $(document).on('mouseover', 'video', function() { $(this).get(0).play(); }); //pause video on mouse leave $(document).on(&ap ...

Modify the class's height by utilizing props

Using Vue 3 and Bootstrap 5, I have a props named number which should receive integers from 1 to 10. My goal is to incorporate the number in my CSS scrollbar class, but so far it's not working as expected. There are no error messages, it just doesn&a ...

What is the best way to achieve a stylish Bootstrap modal design with a blurred and transparent header, as well as a left sidebar that seamlessly blends into

Is it feasible to create a modal with a blurred (transparent) background for the header section, allowing the site to show through? Additionally, can a sidebar on the left side of the modal also be transparent and blurred, revealing the site underneath? C ...

Using the jQuery datetimepicker in the 12-hour format with AM and PM

Hey there! I'm looking to enhance my current code by adding a feature that displays time in a 12-hour format with AM/PM. You can check out an example of this functionality on jsfiddle by following this link: http://jsfiddle.net/8ztsjcos/3/. Thank you ...

jQuery - Enhancing User Experience with Dynamic Screen Updates

Is there a way to update the screen height when resizing or zooming the screen? Whenever I zoom the screen, the arrows break. I'm also curious if the method I'm using to display images on the screen is effective. It's supposed to be a paral ...

Guide to aligning a URL in an HTML file

Greetings all, I'm new to HTML and struggling with how to center a URL on my webpage. For example: <a href="http://www.google.com"> Click Here to Open Google </a> I attempted using the tag and the STYLE attribute but without success. ...

Display the title of an image beneath the image using CSS

Since upgrading my CMS, I've encountered an issue where the captions of images are not showing below the image for thousands of articles. For example: <img src="123.jpg" alt="Texttext" class="caption" style="disp ...

When utilizing the tab key on Chrome, the iFrame fails to scroll

We are currently facing an issue with our web application that is embedded inside an iFrame. On one of our HTML pages, there are numerous textboxes with a large amount of content, requiring users to scroll down to navigate through it all. When using the ...

Developing tabbed sections in XSLT

Utilizing Angular JS within XSLT, I am aiming to develop a tab-based user interface using XML data. The requirement is to generate multiple links and corresponding div elements based on the number of nodes in the XML. To manage the display of these div ele ...

Converting CSS into jQuery

I am exploring ways to create a collapsible section with arrow icons (right and down arrows) in jQuery or JavaScript. Can anyone provide guidance on how to convert my CSS styling into jQuery code? Below is the jQuery approach I have attempted: $(document ...

Prevent scrolling within input field

I have a text entry field with background images that separate each letter into its own box. Unfortunately, an issue arises when I reach the end of the input: the view automatically scrolls down because the cursor is positioned after the last letter enter ...

Encountering an issue when adding SASS Compass Breakpoint to my development project

I'm having trouble integrating breakpoints into my web project. I have SASS, Compass, and breakpoint all installed and I've followed the installation instructions, but it seems to be causing errors. Can someone help me troubleshoot the issue? He ...

The jQuery function for $(window).scroll is not functioning as expected

My challenge is getting the scroll to reveal my scrollTop value I've been working with this code: $(document).ready(function(){ console.log('Hello!'); $(window).scroll(function(){ console.log('Scrolling...'); var wScroll = ...

Assigning the CSS class "active" to the navigation menu in ASP Classic

Seeking assistance with setting a CSS class for the current page in an include file that contains the primary navigation menu. Here is my current progress: public function GetFileName() Dim files, url, segments, current 'obtain c ...

Creating double borders in CSS with the second border extending all the way to the top of the element

Can you help me figure out how to achieve this effect using CSS? It seems like a simple task: border-top: 1px solid #E2E2E2; border-left: 1px solid #E2E2E2; border-bottom: 1px solid #848484; border-right: 1px solid #848484; Just add: box-shadow: 0.7px ...

A workaround for background-size in Internet Explorer 7

Currently, I am working on a project at this link: Everything seems to be functioning well in Firefox and Chrome, however, I have encountered an issue with the background-size property not being supported in IE7. I heavily rely on this property throughout ...

Dynamic Dropdown Selections with AJAX

After exploring various resources, I found a solution for creating a multiple drop-down menu on this site: Roshan's Blog The implementation is mostly successful, except for an issue with the third drop-down box. (Dropdown1: Clients, Dropdown2: Loca ...