:hover border

Working on a horizontal navigation in the Header of a Drupal 7 theme.
I’ve gotten the text to change color when the mouse hovers over them.
I was expecting the same thing for the border to outline the list item as you hover over it

html

<div id="block-system-navigation" class="block block-system block-menu">
 <div class="content">
  <ul class="menu">
    <li class="first leaf"><a href="#about" title="">About</a></li>
    <li class="last collapsed"><a href="/blog">Blogs</a></li>
  </ul>
 </div>
</div>

css

li { display: inline;
border-width: 10px;
 border-color: rgb(97, 192, 189);
    
}
li:hover {
    color: rgb(97, 192, 189);
    border-width: 10px;
    border-color: rgb(97, 192, 189);
}
a {
    text-decoration:none;
    border-width: 10px;
     border-color: rgb(97, 192, 189);
}

a:hover {
    color: rgb(97, 192, 189);
    border-width: 1px;
    border-color: rgb(97, 192, 189);
}

You’re putting hover effects on both the li and a elements. Isn’t that just a bit confusing?

ddi you not that you have no border-style defined? Your border won’t show up unless you do.

1 Like

once it shows up, I’ll delete the spare… I was trying both thinking I may have been overlooking it.

Just work from the anchor then…


<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Test Page</title>
<style>
.menu {
  margin:0;
  padding:0;
  list-style:none;
}
.menu li {
  display: inline-block;
}
.menu a {
  display:block;
  padding:5px;
  text-decoration:none;
  border: 10px solid red;
}
.menu a:hover, .menu a:focus {
  color: red;
  border: 10px solid lime;
}
</style>

</head>
<body>

  <ul class="menu">
    <li><a href="#">About</a></li>
    <li><a href="#">Blogs</a></li>
  </ul>

</body>
</html>

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.