Enhancing user experience by adding a hovering effect of a dot above the navigation

I am attempting to create a hover effect for my navigation links within the navbar. I want a simple filled dot to appear above the currently highlighted list item when hovered over. So far, I have been unsuccessful in achieving this using the CSS pseudo-selectors ':before' and ':after'. I did manage to get a line to show up by utilizing the border property. Is there a more straightforward method to accomplish this?

html

<div class="navbar">
    <ul>
        <li class="active"><a href="#">link 1></a></li>
        <li><a href="#">link 2></a></li>
        <li><a href="#">link 3></a></li>
        <li><a href="#">link 4></a></li>
    </ul>
</div>

Answer №1

Is this the solution you were looking for?

ul li:hover:before {
    content: "";
    position: absolute;
    top: -15px;
    background: red;
    width: 15px;
    height: 15px;
    border-radius: 100%;
    left:calc(50% - 8px);
}

Here is the code in action on JSFiddle.

http://jsfiddle.net/f7RrW/

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 trigger a function with a bootstrap toggle?

A toggle switch has been implemented using bootstrap with the following code snippet: <label > Automatic Refresh: </label> <input class="pull-right" data-size="mini" type="checkbox" data- toggle="toggle"> When the toggle button is in ...

Trouble with JQuery AJAX form submission function not activating during timeout

I have a function that is responsible for submitting forms: function post_form(form_id, type, redir_url) { $( form_id ).submit(function(e) { CheckRequired(e); var postData = $(this).serializeArray(); var formURL = $(this).attr( ...

Database storage of sortable data positions

I am currently working on saving the updated position in the database, but I am facing difficulties when it comes to handling the array-string using PHP. Here is the code that I have: $("#responds").sortable({ axis: 'y', update: fun ...

Exploring jQuery Mobile | Moving Seamlessly between Pages

I'm relatively new to JQM and I'm working on creating a mobile application using jQuery Mobile. Here's the goal I'm aiming for: I have multiple HTML pages, each with its own CSS, JavaScript, and JQM components. What I want is to be ab ...

Steps to disable ajax global setting when making an ajax call in a kendo grid

When working with MVC 5 in the _layout page, I have incorporated .ajaxStart and .ajaxStop events to display a busy indicator. <body> <script type="text/javascript"> $(document).ajaxStart(function (e) { $( ...

Looking to extract, interpret, and display PDF documents using React?

I'm working on displaying a PDF file from an external URL. My goal is to extract text from the PDF for analysis, and then present a specific section of a page to users in my React application. This will involve cropping the content using coordinates o ...

When using html-webpack-plugin with webpack 2, there is no need for a starting slash '/'

I am in the process of migrating my webpack 1 project to webpack 2. Most of it is working smoothly, except for the issue I am facing with html-webpack-plugin: When using it in webpack 2, the script tag that gets generated looks like this: <script typ ...

The Firebase Function consistently ends due to timeout restrictions

I have been utilizing Firebase functions to create notifications through cloud messaging, however, I consistently encounter the following error: Function execution took 60006 ms, finished with status: 'timeout' Despite the error, the notificati ...

Display the div without using javascript/jquery if the radio button is chosen

Could someone help me find a solution similar to the one mentioned here: If Radio Button is Selected Show Div I am specifically looking for a way to achieve this using only HTML and CSS, without involving JavaScript or jQuery. Any suggestions would be gre ...

The Find() method in Mongoose and Node.js might return undefined

I recently encountered an issue while working on a simple function in Node.js and Mongoose that should return true if the model is empty. Even though my mongoose configuration seemed perfectly fine: var mongoose = require('mongoose'); var db = ...

Having an issue with Bootstrap icons displaying as blank boxes across all browsers

It seems to be a similar issue to what's discussed here: Glyphicons rendering as empty box Despite my efforts to search for solutions online, I can't figure out what the problem is. It all began when I first started using bootstrap. I've e ...

The Twitter Bootstrap template page is leaping past the beginning of the div

Currently, I am utilizing the Twitter Bootstrap template from this source to develop a one-page responsive website. While the template is working effectively, I have encountered an issue with the page jumps in the HTML. Specifically, when navigating to th ...

Displaying data stored in a database using JSON format with Ember

I seem to be facing a challenge once again. Let me elaborate on what I am trying to achieve. Within the teammembers template, I aim to display information about Team Members and their details from a specific team by joining 3 tables. Here is an example o ...

Steps to remove the orange circle effect that appears when clicking on a link within a WebView

When attempting to capture the mouse click location, I added an onClick in the body tag. However, each time I click on the page, the entire page briefly turns orange. Is there a way to disable this effect through any setting? ...

How to horizontally align a logo image in the appBar using Material-UI (ReactJS)

I recently incorporated a Material UI library into my React project (material-ui.com) and I've been trying to center my logo within the appbar component. Here is the code that I attempted: <AppBar position="sticky" > <Toolbar> ...

Conceal a card once verified within a bootstrap modal upon successful AJAX completion

On my delete page, there are multiple posts with a delete button. When the delete button is clicked, a Bootstrap modal opens asking for confirmation "Are you sure you want to delete this post? YES : NO" If the YES button is clicked, the .click(function(e) ...

Does the a:hover:not() exception only apply to elements with the .active class?

I developed a navigation bar and split it into 3 distinct sections: 1. id="menu" 2. id="fake" (button to fill space) 3. id="social" My main goal is to exclude the .active page and the fake button from the hover effect, but it seems that using a:hover:not( ...

The clustering functionality on Google Maps markers is ineffective

Encountering an issue with the marker clustering feature on this website (the map is located at the bottom). After including the markerclusterer.js file, I initiated the clustering with the following code: var mc = new MarkerClusterer(map); If you need ...

FingerprintJS is experiencing an issue with the navigator object not being defined, resulting in

I am currently working on extracting browser fingerprint using fingerprintjs2, an npm package in Javascript. However, I encountered the following error: ReferenceError: navigator is not defined Error Logs: https://i.sstatic.net/lWL9Y.png Code Snippet: ...

Exploring the utilization of const within a try-catch block

Revise 2024: Solution: Utilizing the 'var' keyword helps resolve the issue at hand 'const' is a variable defined within a block, so when attempting to scrutinize the code try{ const foo = bar[global.name].foofoo[global.name2]; }ca ...