La barre verticale n'apparaît pas dans IE8 si la page n'est pas suffisamment longue. Dans FF, il y a une solution de contournement pour ce J'ai essayé ce qui suit pour IE8: Toute solution? P> P> Overflow: défilement; code> mais la barre de défilement apparaît des deux côtés. Je ne veux que pour la verticale et non horizontale. Scroll-y ne fonctionne pas. P>
12 Réponses :
oh le figuré. Son
Cela ne fonctionne pas non plus pour IE8 et plus tôt selon le site Web W3school.
Une autre solution consiste à définir la hauteur du corps à 100% - voir A avant / après l'exemple de http://www.ecustomizer.com/msmvp/htmlheightest.htm p>
J'utilise ce qui suit:
html { height: 101%; /* setting height to 101% forces scroll bar to display */ }
essayer p>
-ms-overflow-y: défilement; code> p>
Mettez-le dans votre div i.e. par exemple: p>
html {height: 100%; margin-bottom: 1px;} Makes your page always 1px longer so the scroll bars always appear and only adds 1px scroll to pages that are not long enough so it doesn't make the viewer think they are missing something and scroll down for no reason. Simple and works in all main stream browsers (that i tested)
html, corps { Hauteur: 100,1%; } p>
html { height: 100%; border-bottom: 1px #999 solid; } NOTE: I wanted to force the scrollbar on pages that I KNOW will not need to scroll. This solution is for such a situation.Jonesy's solution didn't work for me in all browsers, but I'm willing to have an insignificant 1px gray stripe which works consistently in all browsers. To me it's better than showing a full 1% extra (chip's solution). Design wise, it's hardly even a concession because it's so insignificant - try it and see what I mean.Also, this solution is going to be super future-proof. If you want to add blank space like the other solutions, there's no telling what optimizations will get built into future browsers and I could imagine some browser detecting wasted blank space and eliminating it (stranger things have happened). By conceding 1px, you are forcing the browser to deal with this 1 pixel no matter what.
Meilleure réponse à la date (mai 2012) Pour forcer la barre de défilement verticale dans Safari, Opera & Firefox est la suivante:
html { height: 101%; /* setting height to 101% forces scroll bar to display */ } html { min-height: 100%; padding-bottom: 1px; }
notant juste que Normalize.css a recommandé:
html { overflow-y: scroll; }
Ajouter Overflow: Auto en CSS pour la balise HTML. P>
Bien voir mon code, le jeu de données est à l'intérieur de 1 div