bootstrap' affix'在导航栏上打破了正确的边距

时间:2017-02-04 21:18:45

标签: css html5 navbar affix

大家好我通过个人网页学习引导程序。我已经创建了一个带有词缀选项的导航栏,但是当向下滚动时,右边距似乎被打破了。你能帮我弄明白为什么吗? 在此先感谢,这里是代码:



df.index = pd.MultiIndex.from_arrays([['Hour'] * len(df.index),
                                      df.index], 
                                      names=(None,None))
df.columns = pd.MultiIndex.from_arrays([['CU-101'] * len(df.columns),
                                        df.columns], 
                                        names=(None,None))

print (df.T)
                             Hour                    
                                1    2    3    4    5
CU-101 Output Energy, (Wh/h)  0.0  0.0  0.0  0.0  0.0
       Lights (Wh)            0.0  0.0  0.0  0.0  0.0
       Lights+Media (Wh)      0.0  0.0  0.0  0.0  0.0
       Total Usage (h)        0.0  0.0  0.0  0.0  0.0




编辑:使用chrome检查器我发现了警告。它说:"关键"宽度:设备宽度"无法识别和忽略。"

1 个答案:

答案 0 :(得分:0)

您错过了一些结束标记。我希望下面的代码片段可以帮助你。



<!DOCTYPE html>
<html lang="en">
  
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width:device-width, initial-scale = 1">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    </head>

    <body>
        <nav class="navbar navbar-inverse navbar-fixed-top" data-spy="affix" data-offset-top="197">
            <div class="container-fluid">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="#">Something</a>
                </div>
                <div class="collapse navbar-collapse" id="myNavbar">
                    <ul class="nav navbar-nav">
                        <li><a href="#">Home</a></li>
                        <li><a href="#">Pag 1</a></li>
                        <li><a href="#">Pag 2</a></li>
                    </ul>
                    <ul class="nav navbar-nav navbar-right">
                        <li>
                            <a href="#"><span class="glyphicon glyphicon-log-in"/></a>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>
        <div class="container-fluid">
            <h1>Some text to enable scrolling</h1>
            <h1>Some text to enable scrolling</h1>
            <h1>Some text to enable scrolling</h1>
            <h1>Some text to enable scrolling</h1>
            <h1>Some text to enable scrolling</h1>
            <h1>Some text to enable scrolling</h1>
            <h1>Some text to enable scrolling</h1>
            <h1>Some text to enable scrolling</h1>
            <h1>Some text to enable scrolling</h1>
            <h1>Some text to enable scrolling</h1>
            <h1>Some text to enable scrolling</h1>
            <h1>Some text to enable scrolling</h1>
            <h1>Some text to enable scrolling</h1>
            <h1>Some text to enable scrolling</h1>
            <h1>Some text to enable scrolling</h1>
            <h1>Some text to enable scrolling</h1>
            <h1>Some text to enable scrolling</h1>
            <h1>Some text to enable scrolling</h1>
        </div>
    </body>
</html>
&#13;
&#13;
&#13;