Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  
  <div id="sidebar">
    <ul id="menu">
      <li>Item 1</li>
      <li>Item 2</li>
      <li>Item 3</li>
    </ul>  
  </div>
    
  <div id="main">Main part. Why does this repaint on menu hover?</div>
</body>
</html>
 
ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
#sidebar {
  width: 200px;
  float: left;
  background-color: lightgreen;
  position: absolute;
}
#main {
  margin-left: 200px;
  width: 500px;
}
ul#menu li {
  height: 30px;
  line-height: 30px;
  padding-left: 20px;
  position: relative;
}
ul#menu li:hover {
  background-color: lightblue;
}
ul#menu li:hover:before {
  content: "";
  width: 4px;
  background-color: red;
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
}
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers