javascript - 向有页脚的表格添加滚动条

标签 javascript css html twitter-bootstrap-3

我是网络开发的新手。我正在使用 react js。我这里有一张 table

这就像,

enter image description here

现在,我的代码是 ->

import React from 'react';
import { connect } from 'react-redux';
import { Table } from 'react-bootstrap';
import './Jobs.css';


class UserJobs extends React.Component {

    constructor(props) {
        super(props);
        console.log("props are ==>", props.jdRecords);
        this.state = {
            jdRecords: props.jdRecords
        }
    }

    render() {
        const compName = {
            fontSize: '14px'
        };

        return (
            <div className="container-fluid">
                <div className="row">
                    <Table striped condensed hover>
                        <thead>
                            <tr>
                                <th>Sr.No.</th>
                                <th>Company Name</th>
                                <th>Technology</th>
                                <th>Job Title</th>
                                <th>Total Score</th>
                                <th>Average Score</th>
                            </tr>
                        </thead>
                        <tbody>{this.props.jobData.map(function (item, key) {
                            return (
                                <tr key={key}>
                                    <td><b style={compName}>{item.id}</b></td>
                                    <td><b style={compName}>{item.attributes.companyName}</b></td>
                                    <td>abc Developer</td>
                                    <td>{item.attributes.name}</td>
                                    <td>30</td>
                                    <td>30</td>
                                </tr>
                            )
                        })}</tbody>
                    </Table>
                    <footer>
                        footer
                    </footer>
                </div>
            </div>
        )

    }
}


function mapStateToProps(state) {
    return {
        jobDescription: state.JobDescriptionData,
        jobData: state.JobDescriptionData.jobData.data
    }
}

export default connect(mapStateToProps, null)(UserJobs);

现在,这里,这个表有 10 多个条目。现在,我只想让那个表格的滚动条而不是整个页面的滚动条,而且它还有 页脚。

So, I tried :

height : 200px;
overflow-y : auto

但这行不通。

因为它也有一个导航栏。

谁能给我一些提示?

最佳答案

您需要为表格包装 div 并添加 max-height as 200, overflow :auto.

关于javascript - 向有页脚的表格添加滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51949514/

相关文章:

javascript - 悬停时播放音频文件

html - 背景图像不适合全屏。高度在下降

javascript - 带有评论框的粘性页脚,如 WhatsApp

javascript - 如何更改此代码中 slider 的布局?

css - 寄存器 0x​​104567911

html - 在旧浏览器上循环播放声音

javascript - 在一个导航下有多个 slider

javascript - 从一组具有相同类名的复选框中获取当前复选框的值

javascript - 用于查找粗体文本的正则表达式

php - 创建与以下下拉菜单相同的 HTML5 范围 "slider"