Design a Stylish Vertical Menu Using LESS CSS

Find AI Tools
No difficulty
No complicated process
Find ai tools

Design a Stylish Vertical Menu Using LESS CSS

Table of Contents

  1. Introduction
  2. Building the Left Menu
  3. Setting the Background and Width
  4. Styling the List Items
  5. Adding Icons to the Menu
  6. Adjusting Padding and Font Sizes
  7. Creating the Active Tab
  8. Adding Message Notifications
  9. Positioning the Notification Circle
  10. Completing the Left Menu

Building the Left Menu

In this tutorial, we will focus on building out the left menu for our Website. The left menu will provide navigation options for the user using our mailer service. The menu will span the entire Height of the page and will consist of items with icons and text. We will walk through the process step by step to ensure that the menu is designed and styled correctly.

Setting the Background and Width

To begin building the left menu, we need to define some variables in our stylesheet. We will Create a section for the left menu and set a variable for the menu width, which is 185 pixels. Each navigation item will have a height of 52 pixels. We will also define colors for the background and the selected state. The selected state will have an alternate color, which we have already declared. With these variables set, we can create a less stylesheet specifically for the left menu.

Styling the List Items

Inside the left menu, we will have a navigation list. Each list item will have an anchor tag that contains an icon and text. We will first set the color of the anchor tags to white and adjust the height and line height to match our variable. The display will be set to block, and the width will span 100% of the list item. The list items will have a padding issue, so we will provide some padding to Align them with the mailer logo.

Adding Icons to the Menu

In order to add icons to the menu, we will use various icon classes. Each list item will have a specific icon associated with it. We will create classes for these icons and set the font size accordingly. By targeting the specific class of the icon, we can ensure that the styles only Apply to the desired elements.

Adjusting Padding and Font Sizes

We need to make some adjustments to the padding of the list items to ensure proper alignment with the mailer logo. By using a Chrome extension called Less CSS Creator, we can easily modify the styles in the browser and preview the changes. We will add the necessary padding and ensure that the styles are applied correctly.

Creating the Active Tab

The active tab in the left menu will have a different background color to indicate that it is currently selected. We will use the class "active" to target the active tab and apply the teal background color. By adding the "active" class to the appropriate list item, we can see the changes in the browser. We will also fix the padding issue by applying it directly to the anchor tag instead of the list item.

Adding Message Notifications

In the message tab of the left menu, we want to add a notification Bubble to indicate the presence of new messages. We will create a div with a class of "notification" and add a small tag inside it. The notification bubble will have a background color and a border radius to make it circular. The small tag will contain the number of new messages. We will use absolute positioning to center the small tag inside the circle and position the circle over the message icon.

Positioning the Notification Circle

To position the notification circle correctly, we need to set the left and top properties. By adjusting these values, we can move the circle to the top right of the message icon. We also need to set the parent element's position to relative to ensure proper positioning. With the correct positioning, the notification circle will appear where desired.

Completing the Left Menu

With all the necessary styles in place, we have successfully built the left menu for our website. It spans the entire height of the page and contains navigation items with icons and text. The active tab has a different background color, and the message tab includes a notification bubble. We have addressed any padding issues and ensured that the styles are applied correctly.

In the next tutorial, we will move on to the signup page, which will be the first content section of our website.


Pros:

  • The left menu provides easy navigation for users.
  • The menu spans the entire height of the page, making it easily accessible.

Cons:

  • The tutorial assumes prior knowledge of HTML and CSS.
  • The process may be time-consuming for beginners.

Highlights:

  • Building the left menu with navigation items
  • Setting background color and width
  • Styling the list items with icons
  • Adjusting padding and font sizes
  • Creating the active tab with a different background color
  • Adding message notifications with a notification bubble
  • Positioning the notification circle correctly
  • Completing the left menu for the website

FAQ

Q: Can I customize the colors of the left menu? A: Yes, you can modify the background color and other styles to match your website's design.

Q: How do I change the icons in the menu? A: You can use different icon classes or replace them with custom icons based on your needs.

Q: Will the left menu work on mobile devices? A: The left menu can be responsive if you apply appropriate CSS media queries and adjust the styles accordingly.

Q: Is it possible to add more navigation items to the menu? A: Yes, you can add as many list items as needed by following the same structure and applying the necessary styles.

Q: Can I use this left menu on other pages of my website? A: Yes, you can reuse the left menu code and styles on other pages by including them in your HTML files.

Most people like

Are you spending too much time looking for ai tools?
App rating
4.9
AI Tools
100k+
Trusted Users
5000+
WHY YOU SHOULD CHOOSE TOOLIFY

TOOLIFY is the best ai tool source.

Browse More Content