| <style> | |
| #parent { | |
| height: 300px; | |
| overflow: auto; | |
| background-color: #aaa; | |
| padding: 10px; | |
| } | |
| .child { | |
| height: 300px; | |
| margin: 5px 0; | |
| background-color: red; | |
| position: relative; | |
| } | |
| </style> | |
| <div id="parent"> | |
| <div class="child"></div> | |
| <div class="child"></div> | |
| <div id="target"class="child"></div> | |
| </div> | |
| <script> | |
| target.scrollIntoView(true); | |
| </script> |