Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 可滚动元素的顶部被隐藏_Html_Css - Fatal编程技术网

Html 可滚动元素的顶部被隐藏

Html 可滚动元素的顶部被隐藏,html,css,Html,Css,我正在做一个项目,包括一个带有可滚动单元格的表格。这看起来可能不是使用表的最优雅的方式,但这是适用于我的用例的方式。不幸的是,我的手机内容的顶部仍然隐藏,我无法滚动到它 以下是项目中的一个非常小的示例(大得多的表中的一个单元格): HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name

我正在做一个项目,包括一个带有可滚动单元格的表格。这看起来可能不是使用表的最优雅的方式,但这是适用于我的用例的方式。不幸的是,我的手机内容的顶部仍然隐藏,我无法滚动到它

以下是项目中的一个非常小的示例(大得多的表中的一个单元格):

HTML

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Document</title>
</head>

<body>

    <table>
        <tr>
            <th>
                <div>
                    SAMPLE CONTENT1. SAMPLE CONTENT2. SAMPLE CONTENT3. SAMPLE CONTENT4. SAMPLE CONTENT5.
                    SAMPLE CONTENT6. SAMPLE CONTENT7. SAMPLE CONTENT8. SAMPLE CONTENT9. SAMPLE CONTENT10.
                </div>
            </th>
        </tr>
    </table>

</body>

</html>

为什么我看不到可滚动文本的前几行?

删除对齐项:居中

th{
边框:黑色5px实心;
}
第四分区{
显示器:flex;
证明内容:中心;
溢出y:自动;
填充物:5px;
宽度:125px;
高度:125px;
}

文件
样本内容1。样本内容2。样本内容3。样本内容4。样本内容5。
样本内容6。样本内容7。样本内容8。样本内容9。样本内容10。

删除对齐项目:居中

th{
边框:黑色5px实心;
}
第四分区{
显示器:flex;
证明内容:中心;
溢出y:自动;
填充物:5px;
宽度:125px;
高度:125px;
}

文件
样本内容1。样本内容2。样本内容3。样本内容4。样本内容5。
样本内容6。样本内容7。样本内容8。样本内容9。样本内容10。

完美!简单的修复!非常感谢你!完美的简单的修复!非常感谢你!
th{
    border: black 5px solid;
}

th div{
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 5px;
    width: 125px;
    height: 125px;
}