我无法滚动

时间:2017-01-22 01:23:50

标签: html css scroll

这是我的.css文件...不明白为什么我不能滚动

#root {
  overflow-y: scroll;
  height: 100%;
}
.titles {
    font-family: times, Times New Roman, times-roman, georgia, serif;
    font-size: 48px;
    line-height: 40px;
    letter-spacing: -1px;
    color: #444;
    margin: 0 0 0 0;
    padding: 0 0 0 0;
    font-weight: 100;
}
.title-subtitle{
    font-family: times, Times New Roman, times-roman, georgia, serif;
    font-size: 28px;
    line-height: 40px;
    letter-spacing: -1px;color: #444;
    margin-top:0px;

}

然后在我的html文件中我有这个:

<!DOCTYPE html>
<html lang="en">
<link rel="stylesheet" type="text/css" href="../src/style.css">
<head>

<meta charset="utf-8">
  <title>React App</title>
</head>
<body>
<div id="root"></div>
</body>
</html>

但每次我垂直渲染或缩小页面大小时,我都无法获得滚动条....

1 个答案:

答案 0 :(得分:0)

要在#root上设置100%,您还必须将htmlbody设置为100%:

html, body {
  height: 100%;
}
相关问题