Jump to content

Align desktop burger menu itens to the top

Go to solution Solved by tuanphan,

Recommended Posts

Posted

Another question for you:

What is the code to make the desktop burger menu the same width of the mobile so that the rest of the page can be seen in desktop mode?

Thanks again! 

MC

Posted
5 hours ago, cruz said:

Another question for you:

What is the code to make the desktop burger menu the same width of the mobile so that the rest of the page can be seen in desktop mode?

Thanks again! 

MC

I see desktop burger is already 100% width

image.thumb.png.ff68e1f3c9e0a7e99e772bbbfb3db0f3.png

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Posted

I know, but I want it to be the same width as the mobile thus occupying 30% of the desktop width.

Posted
On 10/16/2024 at 5:54 AM, cruz said:

Site URL: https://importcarfactory.com/

Hi.

Need CSS code to align my desktop burger menu items to the top as you can see in the mobile mode.

Thanks,

MC

Screenshot 2024-10-16 at 01.52.51.jpg

Screenshot 2024-10-16 at 01.53.04.jpg

To align the items in your desktop burger menu to the top using CSS, you can apply some styling to the menu's container. Here’s a general approach you can take. You might need to adjust the selectors based on your specific HTML structure:

/* Target the burger menu container */
.burger-menu {
    display: flex;                /* Use flexbox for layout */
    flex-direction: column;      /* Stack items vertically */
    align-items: flex-start;     /* Align items to the start (top) */
    position: absolute;          /* Allow positioning without affecting layout */
    top: 0;                      /* Align to the top */
    left: 0;                     /* Adjust left if necessary */
}

/* Target individual menu items */
.burger-menu-item {
    margin: 0;                  /* Remove any default margin */
    padding: 10px 20px;        /* Adjust padding as needed */
}

Implementation Steps:

  1. Inspect the Elements: Use your browser’s developer tools (right-click the menu and select "Inspect") to find the class names of the burger menu and its items. Adjust .burger-menu and .burger-menu-item in the code above to match your actual classes.

  2. Add the CSS: Place the CSS code in your website’s stylesheet. If you have a custom CSS section in your theme settings, you can add it there.

  3. Test Responsiveness: Check the menu on both desktop and mobile views to ensure it looks as intended.

Additional Tips:

  • If your menu is hidden initially and only displayed on click, ensure that the absolute positioning doesn’t interfere with other page elements.
  • You might need to use media queries if you want different styles for desktop and mobile versions.

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.