Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7606337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:23:06+00:00 2026-05-31T00:23:06+00:00

Consider the following structure: <ul> <li><a href=>Home</a><img src=menu_hover_line.jpg class=whiteBarHover /></li> <li><a href=>Contacts</a><img src=menu_hover_line.jpg class=whiteBarHover

  • 0

Consider the following structure:

<ul>
    <li><a href="">Home</a><img src="menu_hover_line.jpg" class="whiteBarHover" /></li>
    <li><a href="">Contacts</a><img src="menu_hover_line.jpg" class="whiteBarHover" /></li>
</ul>

Here a is “a” block element (display:block;) and it is a menu element, with certain height and paddings from right and left:

li
{
display:inline-block;
float:left;
position:relative;  
}
a
{
    text-decoration:none;
    font-family:Arial, Helvetica, sans-serif;
    font-size:14px;
    color:#131313;
    display:block;
    line-height:51px;
    padding:0px 29px;
}
a:hover
{
    background-color:#000;
    border:0 none;
    color:#FFF;
} 
.whiteBarHover
{
    width:40px;
    height:3px;
    position:absolute;
    top:2px;
    visibility:hidden;
}
div#menu li:hover img.whiteBarHover
{
    visibility:visible;
}

The point of the “img” and related css code in each “li” is to have the image shown below

menu_hover_line.jpg =>
enter image description here

on hover event in top center of each menu item. All is done. but the image is not in the center in horizontal direction. How I can center it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T00:23:07+00:00Added an answer on May 31, 2026 at 12:23 am

    If it’s a position absolute then you have to define left:50% & margin-left:-20px; half the width of the image. like this:

    .whiteBarHover
    {
        width:40px;
        height:3px;
        position:absolute;
        top:2px;
        left:50%;
        margin-left:-20px;
        visibility:hidden;
    }
    

    Check this http://jsfiddle.net/BrURq/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following HTML structure for drop-down menu: <ul class=tabMenu> <li><a href=#>Games</a> <div id=sub>
Consider the following data structure: List<Person> People; class Person { List<Car> Cars; List<Hobby> Hobbies;
Consider the following class structure: class Filter { virtual void filter() = 0; virtual
Consider the following class structure: public class Foo<T> { public virtual void DoSomething() {
Consider the following directory structure: MyProject\VS2010\myproject.sln MyProject\VS2010\myproject.csproj MyProject\src\SourceFile1.cs MyProject\src\SourceFile2.cs When I add a new
Consider the following HTML structure: <div class=content> <div class=field field-type-date field-field-event-date> <div class=field-items> <div
consider the following html structure: <div> <div class=top> <div id=id1>123</div> <div> <div class=top> <div
Situation Consider I've got the following class structure: // a user model class UserModel
Consider the following general program structure: Class A has an instance of Class B
Consider the following directory structure: ROOT ------ images ............... logo.png ------ includes ............... vars.php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.