小编Guy*_*Guy的帖子

DIV浮动在TH之上,用于具有固定标题的滚动表,但我无法将标题居中

使用这个小提琴的建议我做了一个固定标题的滚动表:

<!DOCTYPE html>
<html lang='en' dir='ltr'>
<head>
    <meta charset='UTF-8' />
    <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
    <style>
        body {
            font-family: sans-serif;
            font-size: 20px;
        }

        section {
            position: relative;
            border: 1px solid #000;
            padding-top: 2em;
            background: #808;
        }

        #container {
            overflow-y: auto;
            height: 200px;
            padding-top: 1em;
        }

        table {
            border-spacing: 0;
            border-collapse: collapse;
            width: 100%;
        }

        th {
            height: 10px;
            line-height: 0;
            padding-top: 0;
            padding-bottom: 0;
            color: transparent;
            background: #0f0;
            border: 2px solid #f0f;
            white-space: nowrap;
        }

            th > div …
Run Code Online (Sandbox Code Playgroud)

html css tableheader

5
推荐指数
1
解决办法
635
查看次数

标签 统计

css ×1

html ×1

tableheader ×1