0

I need a table with only one table row and elements in the right td being sticky, but my solution doesn't work. I have tried applying position: sticky to the td and to the element itself, but neither works. (Lipsum is to force scrolling)

.navigation {
  position: sticky;
  vertical-align: top;
}
.button {
   position:sticky;
}
<!DOCTYPE html>
<html>
  <body>
    <table>
      <tr>
        <td>Really a whole lot of text that will force scrolling of the site...
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. Sed dignissim lacinia nunc. 
        Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. 
        Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. 
        Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit amet pede facilisis laoreet. Donec lacus nunc, viverra nec, blandit vel, egestas et, augue. Vestibulum tincidunt malesuada tellus. Ut ultrices ultrices enim. Curabitur sit amet mauris. Morbi in dui quis est pulvinar ullamcorper. 
        Nulla facilisi. Integer lacinia sollicitudin massa. Cras metus. Sed aliquet risus a tortor. Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante. Nulla quam. Aenean laoreet. Vestibulum nisi lectus, commodo ac, facilisis ac, ultricies eu, pede. Ut orci risus, accumsan porttitor, cursus quis, aliquet eget, justo. 

        </td>
        <td class="navigation">
          navigation that should be "sticky"
          <button>ClickMe, I'm sticky</button>
        </td>
      </tr>
    </table>
  </body>
</html>
Narusan
  • 482
  • 1
  • 5
  • 18
  • The solution is to avoid using `sticky` due to the current support it has. – VXp Nov 19 '17 at 01:07
  • @VXp How would I achieve the same effect without `sticky`? – Narusan Nov 19 '17 at 01:18
  • You can play around with the https://stackoverflow.com/questions/8913118/how-to-make-table-row-fixed-at-the-top and try to make it work, though the targeted element is the tr and not the td. Usually position fixed works just fine but not with tables. – VXp Nov 19 '17 at 01:40

0 Answers0