Answers for "footer css position bottom"

CSS
0

set footer element at bottom

<html>
<title>Set footer bottom</title>
<body>
<footer style = "position: absolute;bottom: 0;">copyright @2021</footer>
</body>
</html>
Posted by: Guest on July-17-2021
0

footer bottom

<script>
    $(document).ready(function() {
        setInterval(function() {
            var docHeight = $(window).height();
            var footerHeight = $('#footer').height();
            var footerTop = $('#footer').position().top + footerHeight;
            var marginTop = (docHeight - footerTop + 10);

            if (footerTop < docHeight)
                $('#footer').css('margin-top', marginTop + 'px'); // padding of 30 on footer
            else
                $('#footer').css('margin-top', '0px');
            // console.log("docheight: " + docHeight + "\n" + "footerheight: " + footerHeight + "\n" + "footertop: " + footerTop + "\n" + "new docheight: " + $(window).height() + "\n" + "margintop: " + marginTop);
        }, 250);
    });
</script>
Posted by: Guest on October-14-2021

Browse Popular Code Answers by Language