Issue with border-bottom overlapping menu items

Is there a way to add a border-bottom-image (such as an arrow with 159px width) without affecting the width of the <li> element?

I'm facing an issue where setting the width of the <li> to 159px causes layout problems with other elements. Are there any clever tricks to achieve the desired border image effect without disrupting the rest of the design?

lg cgee

Current styling for <li>:

.sub_menu ul li {
    float: left;
    font-family: 'Open Sans', sans-serif;
    font-weight: bold;
    height: 41px;
    margin-right: 20px;
    margin-top: 10px;
}

Styling for the active element:

.sub_menu ul .active {
    background-image: url("../images/sub_menu_border_active.png");
    background-position: center 17px;
    background-repeat: no-repeat;
    position: relative;
    z-index: 100;
}

Answer №1

If you want to achieve the desired result, there are a few options available:

  1. One option is to include min-width: 159px in the li element.
  2. Another possibility is to add an extra element within the li (such as span) with position: absolute and bottom: 0. Make sure to also apply overflow: visible to the li.
  3. Alternatively:

CSS

.sub_menu ul .active {
    position: relative;
    z-index: 100;
    overflow: visible;
}

.sub_menu ul .active:after {
    content: '';
    background-image: url("../images/sub_menu_border_active.png");
    background-position: center 17px;
    background-repeat: no-repeat;
    position: absolute;
    bottom: 0;
    left: 50%;
    margin-left: -80px;
    height: ...;
    width: 159px;
    z-index: 101;
}

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

Master the art of manipulating JSON arrays with jQuery

Looking to extract the information with a specific key and payment value from a JSON array generated by an API request. The desired data is: "Key":"PCP","Payment":170.08 The array in question looks like this: {"VehicleResults":[{"Id":"0","FinanceProduct ...

Steps for removing a recently added list item with a child button included

I'm currently working on developing a multi-section user-generated list application similar to this example. The goal is to allow users to input text into a field and then, based on the button they click, determine which section of the list their new ...

Customizing the appearance of a radio button within a form

I need assistance with styling a form that contains a radio button. I'm looking to customize the appearance of the radio button by adding a background image and also changing the default view of the check image. Additionally, I want the form to be cen ...

Displaying the user's username upon logging into a website is a simple yet effective

I have successfully developed a simple web page using PHP and HTML. However, I am facing an issue in displaying the username after login. Additionally, I would like to hide the login and signup sections after successful login. Can anyone provide assistance ...

Unable to automate tests with file uploads

In my automated tests, I have consistently used the same function to upload files: var path = require('path'); //the file to upload fileToUpload, //this is variable that inserts the path to find file to upload ...

Chrome not displaying fonts properly

Having a font issue in Chrome where specifying "Myriad Pro", Tahoma, Arial results in weird symbols. Works fine in FF, IE, and Safari. Using font-family: Tahoma, Arial; works for all browsers including Chrome. How can Myriad Pro be achieved for IE, FF, a ...

Identifying the previous slide in a Bootstrap 4 Carousel

Imagine I'm on slide 9 and navigate to slide 8 using the link below: <a class="carousel-control-btn" href="#Carousel" role="button" data-slide-to="8"> Now that I'm on slide 8, is there a method to identify the previous slide I came from? ...

If an element exists in one of the dimensions of a multi-dimensional array

I am facing an issue with my 2D array structure. Here is an example of how it looks: `var arr = [["1", "2", "3"], ["4", "5"], ["6"]];' Despite having the value "4" in one of the inner arrays, when I try running $.inArray("4", arr); or arr.indexOf("4" ...

Concealing Bootstrap 3 elements on a split-screen layout

I encountered a peculiar issue with Bootstrap 3. When I resize my browser width to half the screen, there is a slight 1px threshold where both "hidden-xs" and "hidden-sm" elements become visible simultaneously. Is there a way to fix this so that only one o ...

Guide on incorporating .erb into a data-target parameter in Ruby on Rails

In my Rails application, I am using a Bootstrap (3.3) collapse feature to reply to individual comments. The issue I'm facing is that the data-target and aria-controls attributes need to be unique for each comment. Currently, the data-target is set to ...

It is not possible to make a comparison between two Strings within a JSP file

I have this unique JSP file that contains the following code: <SELECT name="brandsFrom" onchange="as()"> <c:forEach items="${brandsSelectedList}" var="brands"> <c:if test="${brands.name == nam}"> <option value="${b ...

Implementing hashing with resumable.js

Looking for a way to include hashing in resumable.JS by utilizing the "fileAdded" event hook. Any suggestions on how to add hash to each chunk? ...

Tips for preserving session on an Atheros board with C programming to access a website

Currently, I am utilizing the Atheros development board with LSDK-9.2.0_U10.5.13 stack and mips-linux-2.6.31 Linux version. On the board, I have c file, html, js, and css files, without utilizing the cgi library or any scripting language like php. My curr ...

The combination of Masonry, FlexSlider, and endless scrolling functionality creates a

I am currently using the Masonry layout and implementing infinite scroll functionality through a jQuery plugin. Within this content, I have various FlexSlider slideshows. Unfortunately, when I trigger the infinite scroll feature, the slider does not displa ...

Update the header by changing the background of all elements within it, while keeping the rest of the page as is

I am currently creating a Gatsby site with a layout and header component to construct pages. Each component has its own stylesheet (layout.module.scss and header.module.scss). Below is the code snippet: /* layout.js */ import React from "react" ...

What is the correct way to show a JavaScript response on the screen?

Here is the JavaScript code I used to call the server API: <script type='text/javascript'> call_juvlon_api(apikey, 'getAvailableCredits', '', function(response) { document.getElementById('show').innerHT ...

Is it possible for me to input text into html while the page is loading?

Is there a way to preload external files while a web page is loading? I'm looking to incorporate a JavaScript templating engine into my website and prefer to store my templates in separate files. Instead of loading these templates asynchronously, I&ap ...

CodeMirror version 5.62.3 is experiencing some challenges with the scrollbar functionality, editor size, and line wrapping

During my HTML/CSS/JS coding session, I encountered a challenge with CodeMirror version 5.62.3. Specifically, I was striving to make the scrollbar visible in the code editor, using C# as the language mode. However, despite setting the editor's height ...

Discovering the presence of a NAN value within a JSON string

Consider the following scenario: I have a function that receives jsonData in JSON format, and I want to validate the variable jsonData to check for NaN. How can I achieve this? function save() { var jsonData = getEnteredValue(); $.ajax({ ...

Embrace the presence of null values on the client side

When utilizing the code below, I can determine the location of logged-in users. However, there are some users who do not have a specific location assigned. For example, Administrators are common for all locations. In such cases, how can I set it so that ...