Crash Override
Crash Override

Reputation: 1427

CSS Selected Item Navigation Arrow on Bottom

I am having trouble making a CSS styled navigation bar that has a white arrow (triangle) pointing upwards at the selected nav item. The white arrow (triangle) blends with the body below, and is centered on the text box. Something like this screenshot:

example of what I'm trying to do

Anyone have any suggestions on how to specify a "selected" CSS styling for the nav item as shown in the above screenshot?

I'm trying to create a CSS style called "activate", so <li class="activate"><a href="#">Overview</a></li> makes the arrow. Here is a jsfiddle of what I have so far https://jsfiddle.net/v680tfvr/ which kind of works, but the highlighting is too big when the user hovers over the menu item, and a second little arrow appears near the top. Seem simple, I just can't figure it out!

Upvotes: 2

Views: 2390

Answers (1)

Praveen Kumar Purushothaman
Praveen Kumar Purushothaman

Reputation: 167182

I have made the following changes:

  • Fixed the Border
  • Fixed the heading
  • That mysterious thing doesn't appear on hover

Code

.submenu {
    height: 40px;
    overflow: hidden;
}

.submenu .activate:after {
    content: '';
    position: relative;
    width: 0;
    height: 75px;
    left: 40%;
    top: -39px;
    border-left: 10px outset transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid #ffffff;
}

Fiddle: https://jsfiddle.net/v680tfvr/5/

Upvotes: 3

Related Questions