Reputation: 944
I am trying to create a CSS Menu bar.
Here is Fiddle link
Now, notice in the first menu item (Brushes) where I added ul
and gave it class of submenu
, the text shifts to the left. For the bottom two, its aligned in the middle. Why is this happening and how can I solve this problem?
I want all the menuItem text aligned in the middle even after adding subMenus.
Upvotes: 1
Views: 93
Reputation: 478
The main problem is the "SUBMENU" element in page. It take spase and push the brushes menu to left
try to resolve putting:
.menuItems{
width: 100%;
}
and
.menuItems:hover{
width: 110%; /*example*/
}
Hope was helpful...
Upvotes: 0
Reputation: 99484
Setting width: 100%
to .menuItems
may hurts the effects. Just Remove width: inherit;
from .menuItems a
selector.
Upvotes: 1
Reputation: 89
If i understand you right, this helps you:
.menuItems a {
display: block;
line-height: 40px;
height: inherit;
width: inherit;
text-align: center;
}
Upvotes: 0
Reputation: 15749
Reason is .menuItems
is not having a width of 100%
. If it is changed to 100%
, it works fine.
Here is the WORKING SOLUTION
The Code Change:
.menuItems{
width: 100%;
}
Same goes with .menuItems:hover
Upvotes: 1