M
M
MonsterAndrew2018-03-20 15:56:48
css
MonsterAndrew, 2018-03-20 15:56:48

How to adjust the height of the table to fit the screen on page load?

Good afternoon! I have a table with min-height: 375px;. I need to write a function in JavaScript that, after loading the page, if there is any space after the table to the end of the page, it would add this space to 375 and stretch the table, but so that the scrollbar does not appear.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
MonsterAndrew, 2018-03-20
@MonsterAndrew

$('#scrollArea').css("max-height", $(document).height() - $('#scrollArea').offset().top - 20);

A
AskJs, 2018-03-20
@AskJs

height: 100%
max-height: 100%

H
hardcorelite, 2018-03-20
@hardcorelite

$(document).ready(function{
    $('.myclass').css("height", $(document).height());
})

S
Sanches, 2018-03-20
@Sanches

You can also do this: https://codepen.io/abnmt/pen/LdWEJY?editors=0010

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question