1

I'm working on my web site. If you go to the page after the login, you can see that the page scrolls horizontally and vertically. Is it possible to make the page fit the entire screen without need of the scrollbar? I'm using materialize and the second column of the site (the pale blue part) has a 2px margin.

Thank you!

(for the login "prova" and "prova")

SOLVED:

body {
overflow:hidden;}
Roberto Aureli
  • 1,428
  • 2
  • 12
  • 23

2 Answers2

1

Yes it is possible. Just turn off scrolling. You can get the screen width and height at the beginning. Then write something like this to update your component sizes.

function updateSize() {

var winWidth  = $(window).width(),

winHeight = $(window).height();

$('.loginButton').css({

width:winWidth * 0.2,

height:winHeight * 0.2

});

}

$(window).resize(function() {

updateSize();

});
Serhan Oztekin
  • 475
  • 7
  • 20
1

You have a 2px margin on #map that's causing the horizontal scroll bar.

You need to add a doctype <!DOCTYPE html>. All modern web pages require this or else you will be in "quirks mode"; a place you never want to be. Adding that may change your layout to some extent but you started out in quirks. You don't want to be in quirks.

Rob
  • 14,746
  • 28
  • 47
  • 65
  • Can i remove the scollbar without removing the margin? And for the vertical one? (i've added the doctype) – Roberto Aureli May 15 '16 at 14:08
  • I don't understand the purpose of the 2px margin. – Rob May 15 '16 at 14:17
  • Only for "aesthetic" reasons – Roberto Aureli May 15 '16 at 14:18
  • You need to look into your actual widths to see if they are adding up to 100% in actual pixels. Absolutely positioning that element is taking it out of the normal flow and making it overflow the body which is what is causing the horizontal scrollbar. The problem, vertically, is more work than can be handled here and should probably be a separate question after you fix the horizontal one. – Rob May 15 '16 at 14:23
  • Pratically what should I do? Set it to relative? – Roberto Aureli May 15 '16 at 14:34