简体   繁体   中英

White space at the bottom of my website

Well, I have a weird problem. I search a lot for the last several hours and all the similar problems couldn't fit exactly on my own.

In my website, all the urls with a second slash have a big white space at the bottom of the website. All the site above this space is scrollabe.

I have the same CSS file in all my url

http://localhost/testurl
http://localhost/testurl/withanotherslash

The first url doesn't have a problem, while the second has the white space. I checked the same html file in both urls.

Here is how I load the css in the second url:

    <link rel="stylesheet" href="../static/css/bootstrap.min.css" />
    <link rel="stylesheet" href="../static/css/jquery-ui.css" />
    <link rel="stylesheet" href="../static/css/font-awesome.css" />
    <link rel="stylesheet" href="../static/css/unicorn.css" />

I use two dots in the second url and one dot in the first url. I test it in Chrome and Firefox.

Here is a screenshot:

截屏

HTML Code:

<!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="../static/css/bootstrap.min.css" />
        <link rel="stylesheet" href="../static/css/jquery-ui.css" />
        <link rel="stylesheet" href="../static/css/font-awesome.css" />
        <link rel="stylesheet" href="../static/css/unicorn.css" />



    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <script type="text/javascript" src="../static/js/jquery.min.js"></script>
    <script src="../static/js/bootstrap.min.js"></script>
    <script src="../static/js/unicorn.js"></script>


    </head> 
    <body data-color="grey">
        <div id="wrapper">
            <div id="header">
                <div style="width:200px;">
                    <img style="display:block;margin-left:auto;margin-right:auto;padding-top:5px" src="../static/img/paulie.gif"/>
                </div>
            </div>

            <div id="sidebar">
                <div id="search" style="margin-top:80px">
                <form method="post" action="/authorsearch">
                    <input type="text" name='authorname' placeholder="Search for an author...">
                    <button type="submit"></button>
                </form>
                </div>
                <ul>
                    <li><a href="/"><i class="fa fa-home"></i><span>Dashboard</span></a></li>
                    <li><a href="/articles"><i class="fa fa-book"></i><span>Articles</span></a></li>
                    <li><a href="/editors"><i class="fa fa-user"></i><span>Editors</span></a></li>
                    <li><a href="/authors"><i class="fa fa-user"></i><span>Authors</span></a></li>
                    <li><a href="/countries"><i class="fa fa-globe"></i><span>Countries</span></a></li>
                    <li class="submenu">
                        <a href="#"><i class="fa fa-flask"></i><span>Settings</span></a>
                        <ul>
                            <li><a href="/settings/addarticle"><span>Add an article</span></a></li>
                            <li><a href="/settings/addauser"><span>Add a user</span></a></li>
                            <li><a href="/settings/allusers"><span>All users</span></a></li>
                        </ul>
                    </li>
                </ul>

            </div>

            <div id="content">
                <div id="content-header" class="mini">
                    <h1>My title</h1>
                </div>

                <div class="container-fluid">
                    <div class="row">
                        <div class="col-xs-12 center" style="text-align: center;">                  
                            <ul class="quick-actions">
                                <li>
                                    <a href="/">
                                        <i class="icon-home"></i>
                                        Dashboard
                                    </a>
                                </li>
                                <li>
                                    <a href="/articles">
                                        <i class="icon-survey"></i>
                                        Articles
                                    </a>
                                </li>
                                <li>
                                    <a href="/editors">
                                        <i class="icon-people"></i>
                                        Editors
                                    </a>
                                </li>
                                <li>
                                    <a href="/authors">
                                        <i class="icon-people"></i>
                                        Authors
                                    </a>
                                </li>
                                <li>
                                    <a href="/countries">
                                        <i class="icon-web"></i>
                                        Countries
                                    </a>
                                </li>
                            </ul>
                        </div>  
                    </div>
                    <br />
                    <div class="row">
                        <div class="col-xs-12">
                            <div class="widget-box">
                                <div class="widget-title">
                                    <h5>Users Database</h5>
                                </div>
                                <div class="widget-content nopadding">
                                    <table  id="myTable" class="table table-bordered table-striped table-hover">
                                        <thead>
                                            <tr>
                                                <th>Username</th>
                                                <th>Password</th>
                                                <th>Delete</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            %for user in users:
                                            <tr>
                                                <td>{{user['username']}}</td>
                                                <td>{{user['password']}}</td>
                                                <td>test</td>
                                            </tr>                          
                                            %end            
                                        </tbody>
                                    </table>
                                </div>
                            </div>                  
                        </div>
                    </div>
                </div>

            </div>
            <div class="row" style="margin-bottom:0px">
                <div id="footer" class="col-xs-12">
                    2014 &copy; Title. Brought to you by <a href="#">me</a>
                </div>
            </div>
        </div>

    </body>

</html>

The CSS file is from this bootstrap template

And here is my backend in Python Bottle and how I call the CSS files:

@bottle.get('/static/css/<filename:re:.*\.css>')
def stylesheets(filename):
    return bottle.static_file(filename, root='./static/css/')

That's how the theme is designed to work. On a shorter page like this one you'll see that gap on larger screens.

An easy solution is to set the body background color to the same as the footer/wrapper color, which extends the footer color to the bottom of the page. Eg

body {background: #3c3c3c;}

An alternative would be to use a sticky footer setup, but that's messier and might look a bit silly anyhow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM