我现在有三个<tr>,第一个tr是空白的,所以会被第二个tr挤上来,如何才能让空白tr不被挤掉?


import React from 'react';

class BaseComponent extends React.Component {
    _bind(...methods) {
        methods.forEach( (method) => this[method] = this[method].bind(this) );
    }
}

class NotFoundPage extends BaseComponent {
    constructor(props) {
        super(props);
        // this._handleFoo = this._handleFoo.bind(this);
        // this._bind('_handleClick', '_handleFoo');
        this.state = {
            time: 10
        }
    }

    // 倒数
    redirect(){
        let nextTime = this.state.time - 1;

        if(this.state.time<=0){
            let strTime = '无法自动跳转到首页';
            //document.getElementById('num').innerHTML=0;
            document.getElementById('jumpTo').innerHTML=strTime;
            //location.href="http://127.0.0.1:6600/#/";
            //document.getElementById('error').innerHTML=strTime;

        }
        else{
            // console.log(nextTime);
           // document.getElementById('num').innerHTML=nextTime.toString();
            this.setState({ time: nextTime });
        }
    }

    cleanStyle(){
        document.getElementById('app').style.transform = 'none';
        document.getElementsByClassName('notFoundPage')[0].style.backgroundColor = 'white';
    }

    componentDidMount() {
        // this.timer = setInterval(()=> this.redirect(), 1000);
        this.cleanStyle();
    }

    render () {
        var divStyle = {
            fontSize:30,


        }
        var tableStyle ={
            cellSpacing: 0,
            width: '100%',
            border: 0,

        };

        var fontStyle = {
            fontFamily:'Times New Roman',
            fontSize:80
        }

        return (
            <div style={divStyle}>
                <table style = {tableStyle}  cellPadding='2' cellSpacing='0'>
                    <tbody>
                    <tr>
                        <td style={{whiteSpace:'nowrap', width: '1%'}} rowSpan='3' >
                            <b>
                                <span style={{...fontStyle, color: '#0039b6'}}>S</span>
                                <span style={{...fontStyle, color: '#c41200'}}>o</span>
                                <span style={{...fontStyle, color: '#f3c518'}}>r</span>
                                <span style={{...fontStyle, color: '#c41200'}}>r</span>
                                <span style={{...fontStyle, color: '#0039b6'}}>y</span>
                            </b>
                        </td>
                        <td>  </td>
                    </tr>

                    <tr>
                        <td style={{backgroundColor:'#3366cc'}} >
                            <span style={{fontFamily:'arial,sans-serif', color:'#ffffff', fontSize:30}} ><b>404
                        Error</b>
                    </span>
                        </td>
                    </tr>

                    <tr>
                        <td> </td>
                    </tr>
                    </tbody>
                </table>




                <blockquote>
                    The requested URL was not found on this server.
                    <ol>
                        <li>请检查您输入的网址是否正确。</li>
                        <li>确认无误有可能我们的页面正在升级或维护。</li>
                        <li>您可以尝试访问以下链接。
                            <ul style={{color: 'red'}}>
                                <li id={'jumpTo'}><span id='num' style={{color: 'red'}}>10</span>秒后自动跳转到主页</li>
                            </ul>
                        </li>
                    </ol>
                    <p></p>
                </blockquote>

            </div>

        );
    }
}

export default NotFoundPage;

clipboard.png

使用<td>&nbsp;</td>

阅读 3.1k
3 个回答

第一个tr里面加个 &nbsp ,占位就行了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题