Tips for creating a wide mobile menu

I am attempting to make the mobile menu full width, but so far my efforts have been unsuccessful.

#menu-main-2 {
      background-color:#FFFFFF !important;
      padding-left:15px;
      max-width: unset;
      width: 100%;
}

view mobile menu

Answer №1

Seems like the width of the parent container is already at its maximum capacity. If you want it to be snug against the edges, you'll have to either increase the container's width or use position: absolute for the ul, and then make the container relative.

If you prefer the main list items in the ul to be horizontal across the top, with only the sub-items dropping down, you'll need to apply flex styling to the ul:

#menu-main-2 {
   display: flex;
}

Answer №2

To achieve full width, consider using width:100vw

Viewport Width (vw) – It represents a percentage of the entire viewport width. For example, setting 10vw will be equivalent to 10% of the current viewport width, which translates to 48px on a 480px wide phone screen. The distinction between % and vw is akin to the contrast between em and rem. A % length is relative to the local context (container element) width, whereas a vw length corresponds to the complete browser window width.

Answer №3

To achieve full width, you can implement the following CSS:

#menu-main-2 
 {
  position: absolute;
  top: 2rem;
  right: 0;
  bottom: 0;
  left: 0;
 }

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

Having trouble retrieving specialized data from the get_post_meta function

$wp_query = new WP_Query([ 'post_type' => 'office', 'post_status' => 'any', 'posts_per_page' => -1, ]); $offices = []; if (count($wp_query->posts) > 0) { $offices = $wp_query ...

Embedding SVG or image code within the </style> tags is a common practice in web development

Can anyone assist me in placing this code within </style>? I am unsure of how to proceed with this. I believe the best approach would be to start by moving most of it into </style>, and then I can decide what should remain there. I would grea ...

Change the width of the webpage inside the iframe

I am working with an iframe that has a fixed width and height of 400px. I want to load a web page in the iframe, but I need to adjust the width of the source to fit my iframe perfectly. The height is not an issue as I can add a scrollbar if needed. Here ...

Centered alignment with floating divs of abbreviated length

My HTML file has a structure similar to the following: <div style="float:right"> A line of text, floating to the right </div> <div style="text-align:center"> And here, several lines of<br /> text which should be centered. </div& ...

Is there a way to shift the display of inline-block to the right?

I'm struggling with positioning a div that's nested within a display:inline-block. How can I align it to the right side of the container? <div style='width:100%'> left <div style='display:inline-block;position:relative;r ...

PHP persistent forms dropdowns and checkbox selection

I am currently working on a PHP form and I am facing an issue with the drop-down boxes and checkboxes. I want them to stay filled even if I don't select something, maintaining the previously entered details while leaving the unfilled parts empty. I ha ...

flexbox wrapping text styling

Can text be wrapped in flex within a fixed width container? For example: img username added you as a friend Instead of: user added img name you as a friend I am able to achieve this if the image and 'a' were separat ...

Tips on positioning a button at the bottom of the screen in React Native

I am using the FAB component from the react native paper library. I want to align the button at the bottom, but it is overlapping with a text field. How can I position it below the text field? Please refer to the screenshot below: Here is the code snippet ...

What is the proper method for changing the height of this component in HTML?

Hey there! I'm brand new to HTML and I'm embarking on a little project for myself to enhance my skills. I have a question about adjusting the height of some text - I want it to look similar to Twitter, where each "tweet" is clearly separated from ...

The positioning attribute and flexible height in CSS are essential for creating dynamic

My goal is to create a layout with 3 DIVs inside a container, similar to table rows. top {height = 100px} / middle {height = dynamic} / bottom {height = 100px} I am trying to figure out the best approach to make the height of the middle div dynamic whi ...

How to perfectly center an absolute positioned icon on a 767px screen

The icons positioned absolutely in the two columns must remain center aligned across all screen resolutions. The media query below attempted to align the icon on mobile devices, but it is inaccurate for any resolution. How can I correct the CSS? @media scr ...

Display the PrimeFaces dialog in the middle of the screen

I've encountered an issue with positioning dialogs on different pages. I tried using a CSS code to center them on the screen, but it didn't work as expected. .ui-dialog{ position: fixed; top: 50%; left: 50%; margin-top: -50px; ...

How can you style a two-item list in Material-UI React to display the items side by side?

I have a list that contains two items: 'label' and 'value'. This is the current layout: https://i.stack.imgur.com/HufX7.png How can I rearrange the items on the right to be positioned next to the label on the left? https://i.stack.im ...

Inheritance of currentColor in SVG URLs

Seeking the same solution as mentioned in How can an SVG image inherit colors from the HTML document?, specifically when applied to an svg image used as content on a :before pseudo-element. (The intended outcome is for both checkmarks to adopt the red col ...

Is it possible to use a JQuery function after a page redirect has occurred

Take a look at this interesting fiddle! View the Fiddle I am interested in creating links that scroll to different sections of content areas on my site, similar to the footer links in the example. I have been suggested to use Anglers routing system, but ...

Only apply the CSS rule to all pages except for one

I'm a beginner when it comes to css. In my wordpress website editor (Onetone theme), I added the following rule to my 'custom css field': html, body {margin: 0; height: 100%; overflow: hidden} It's working well...the scrollbar is gone ...

Dynamic CSS Class Implementation with KnockoutJS

Greetings, I am seeking assistance as I am new to KnockoutJS. I am working with a class named green-bar that I need to activate when two particular states are true. Unfortunately, the solution I came up with below is not functioning correctly, and I'm ...

Mobile media queries are ineffective despite implementing the viewport meta tag

I am facing an issue that even though I have tried various solutions, my media queries are not working on mobile devices after adding the viewport meta tag. Can anyone provide insight into why this might be happening? Update: Upon further investigation, I ...

Tips for implementing visual alterations using dynamically generated HTML scripts

When I dynamically generate HTML code from markdown, I typically wrap it in the <p></p> tag like so: <p class="embedded_markdown"> ... <h1>...</h1> ... <h3>...</h3> ... </p> I decided to experiment with sho ...

How can HTML text be highlighted even when it's behind a transparent div?

In my React application, I am facing an issue with a transparent div that serves as a dropzone for draggable elements. This div covers text and also contains children elements that may have their own text content. <Dropzone> <SomeChild> . ...