Html 使材料设计布局全屏显示

Html 使材料设计布局全屏显示,html,css,ruby-on-rails,ruby,material-design,Html,Css,Ruby On Rails,Ruby,Material Design,我开始学习RubyonRails,并因此编写了一个小网站。我对前端开发也是新手 我试图通过Rails application.html.erb实现侧栏和标题,我认为这是出现问题的地方。我使用了谷歌材料设计模板() 正如你在截图中看到的,问题是身体的大部分是白色的。奇怪的是,刷新页面后,所有内容都能正确显示 谢谢你的帮助 以下是我目前的代码: <!DOCTYPE html> <html> <head> <meta charset

我开始学习RubyonRails,并因此编写了一个小网站。我对前端开发也是新手

我试图通过Rails application.html.erb实现侧栏和标题,我认为这是出现问题的地方。我使用了谷歌材料设计模板()

正如你在截图中看到的,问题是身体的大部分是白色的。奇怪的是,刷新页面后,所有内容都能正确显示

谢谢你的帮助

以下是我目前的代码:

  <!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="description" content="A front-end template that helps you build fast, modern mobile web apps.">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">

        <title>HouseholdBook</title>

        <!-- Add to homescreen for Chrome on Android -->
        <meta name="mobile-web-app-capable" content="yes">
        <link rel="icon" sizes="192x192" href="images/android-desktop.png">

        <!-- Add to homescreen for Safari on iOS -->
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-title" content="Material Design Lite">
        <link rel="apple-touch-icon-precomposed" href="images/ios-desktop.png">

        <!-- Tile icon for Win8 (144x144 + tile color) -->
        <meta name="msapplication-TileImage" content="images/touch/ms-touch-icon-144x144-precomposed.png">
        <meta name="msapplication-TileColor" content="#3372DF">

        <link rel="shortcut icon" href="images/favicon.png">

        <style>
            #view-source {
                position: fixed;
                display: block;
                right: 0;
                bottom: 0;
                margin-right: 40px;
                margin-bottom: 40px;
                z-index: 900;
            }

        </style>

        <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
        <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
        <%= csrf_meta_tags %>
    </head>
    <body>
        <div class="demo-layout mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header">
            <header class="demo-header mdl-layout__header mdl-color--grey-100 mdl-color-text--grey-600">
                <div class="mdl-layout__header-row">
                    <span id="headerLabel" class="mdl-layout-title">Home</span>
                    <div class="mdl-layout-spacer"></div>
                    <div class="mdl-textfield mdl-js-textfield mdl-textfield--expandable">
                        <label class="mdl-button mdl-js-button mdl-button--icon" for="search">
                            <i class="material-icons">search</i>
                        </label>
                        <div class="mdl-textfield__expandable-holder">
                            <input class="mdl-textfield__input" type="text" id="search">
                            <label class="mdl-textfield__label" for="search">Enter your query...</label>
                        </div>
                    </div>
                    <button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon" id="hdrbtn">
                        <i class="material-icons">more_vert</i>
                    </button>
                    <ul class="mdl-menu mdl-js-menu mdl-js-ripple-effect mdl-menu--bottom-right" for="hdrbtn">
                        <li class="mdl-menu__item">About</li>
                        <li class="mdl-menu__item">Contact</li>
                        <li class="mdl-menu__item">Legal information</li>
                    </ul>
                </div>
            </header>
            <div class="demo-drawer mdl-layout__drawer mdl-color--blue-grey-900 mdl-color-text--blue-grey-50">
                <header class="demo-drawer-header">
                    <%= image_tag("user.jpg", :class =>"demo-avatar")%>
                    <div class="demo-avatar-dropdown">
                        <span>hello@example.com</span>
                        <div class="mdl-layout-spacer"></div>
                        <button id="accbtn" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
                            <i class="material-icons" role="presentation">arrow_drop_down</i>
                            <span class="visuallyhidden">Accounts</span>
                        </button>
                        <ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="accbtn">
                            <li class="mdl-menu__item">hello@example.com</li>
                            <li class="mdl-menu__item">info@example.com</li>
                            <li class="mdl-menu__item">
                                <i class="material-icons">add</i>Add another account...</li>
                        </ul>
                    </div>
                </header>
                <nav class="demo-navigation mdl-navigation mdl-color--blue-grey-800">
                    <a class="mdl-navigation__link" href="<%=root_path%>">
                        <i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">home</i>Home</a>
                    <a class="mdl-navigation__link" href="<%=items_path%>">
                        <i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">list</i>Übersicht</a>
                    <div class="mdl-layout-spacer"></div>
                    <a class="mdl-navigation__link" href="">
                        <i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">help_outline</i>
                        <span class="visuallyhidden">Help</span>
                    </a>
                </nav>
            </div>

            <main class="mdl-layout__content mdl-color--grey-100">
                <%= yield %>
            </main>
        </div>

        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" style="position: fixed; left: -1000px; height: -1000px;">
            <defs>
                <mask id="piemask" maskContentUnits="objectBoundingBox">
                    <circle cx=0.5 cy=0.5 r=0.49 fill="white"/>
                    <circle cx=0.5 cy=0.5 r=0.40 fill="black"/>
                </mask>
                <g id="piechart">
                    <circle cx=0.5 cy=0.5 r=0.5/>
                    <path d="M 0.5 0.5 0.5 0 A 0.5 0.5 0 0 1 0.95 0.28 z" stroke="none" fill="rgba(255, 255, 255, 0.75)"/>
                </g>
            </defs>
        </svg>
        <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 500 250" style="position: fixed; left: -1000px; height: -1000px;">
            <defs>
                <g id="chart">
                    <g id="Gridlines">
                        <line fill="#888888" stroke="#888888" stroke-miterlimit="10" x1="0" y1="27.3" x2="468.3" y2="27.3"/>
                        <line fill="#888888" stroke="#888888" stroke-miterlimit="10" x1="0" y1="66.7" x2="468.3" y2="66.7"/>
                        <line fill="#888888" stroke="#888888" stroke-miterlimit="10" x1="0" y1="105.3" x2="468.3" y2="105.3"/>
                        <line fill="#888888" stroke="#888888" stroke-miterlimit="10" x1="0" y1="144.7" x2="468.3" y2="144.7"/>
                        <line fill="#888888" stroke="#888888" stroke-miterlimit="10" x1="0" y1="184.3" x2="468.3" y2="184.3"/>
                    </g>
                    <g id="Numbers">
                        <text transform="matrix(1 0 0 1 485 29.3333)" fill="#888888" font-family="'Roboto'" font-size="9">500</text>
                        <text transform="matrix(1 0 0 1 485 69)" fill="#888888" font-family="'Roboto'" font-size="9">400</text>
                        <text transform="matrix(1 0 0 1 485 109.3333)" fill="#888888" font-family="'Roboto'" font-size="9">300</text>
                        <text transform="matrix(1 0 0 1 485 149)" fill="#888888" font-family="'Roboto'" font-size="9">200</text>
                        <text transform="matrix(1 0 0 1 485 188.3333)" fill="#888888" font-family="'Roboto'" font-size="9">100</text>
                        <text transform="matrix(1 0 0 1 0 249.0003)" fill="#888888" font-family="'Roboto'" font-size="9">1</text>
                        <text transform="matrix(1 0 0 1 78 249.0003)" fill="#888888" font-family="'Roboto'" font-size="9">2</text>
                        <text transform="matrix(1 0 0 1 154.6667 249.0003)" fill="#888888" font-family="'Roboto'" font-size="9">3</text>
                        <text transform="matrix(1 0 0 1 232.1667 249.0003)" fill="#888888" font-family="'Roboto'" font-size="9">4</text>
                        <text transform="matrix(1 0 0 1 309 249.0003)" fill="#888888" font-family="'Roboto'" font-size="9">5</text>
                        <text transform="matrix(1 0 0 1 386.6667 249.0003)" fill="#888888" font-family="'Roboto'" font-size="9">6</text>
                        <text transform="matrix(1 0 0 1 464.3333 249.0003)" fill="#888888" font-family="'Roboto'" font-size="9">7</text>
                    </g>
                    <g id="Layer_5">
                        <polygon opacity="0.36" stroke-miterlimit="10" points="0,223.3 48,138.5 154.7,169 211,88.5
                294.5,80.5 380,165.2 437,75.5 469.5,223.3   "/>
                    </g>
                    <g id="Layer_4">
                        <polygon stroke-miterlimit="10" points="469.3,222.7 1,222.7 48.7,166.7 155.7,188.3 212,132.7
                296.7,128 380.7,184.3 436.7,125     "/>
                    </g>
                </g>
            </defs>
        </svg>
        <a href="https://github.com/google/material-design-lite/blob/master/templates/dashboard/" target="_blank" id="view-source" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored mdl-color-text--white">View Source</a>
        <script src="https://code.getmdl.io/1.1.3/material.min.js"></script>

    </body>
</html>

户籍
#视图源{
位置:固定;
显示:块;
右:0;
底部:0;
右边距:40px;
边缘底部:40px;
z指数:900;
}
正确%>
正确%>
家
搜索
输入您的查询。。。
更多
    关于 联系 法律信息
“演示化身”)%%> hello@example.com 向下箭头 账户
  • hello@example.com
  • info@example.com
  • 添加另一个帐户
500 400 300 200 100 1. 2. 3. 4. 5. 6. 7.

在“刷新页面后,所有内容都正确显示”是什么意思?只有当您直接导航到URL时才会出现此问题?如果我通过URL访问该页面,则会出现问题,因为该页面已被弄乱。浏览页面的链接也是如此。在我点击“刷新”后,它是正确的。@NiclasC。查看删除Turbolinks gem是否有帮助。@maxpleaner确实有帮助,但在加载页面后,我会得到完全相同的白色屏幕,但只有一毫秒,直到页面完全加载为止
false%>
是我删除的行代码。@NiclasC。也许可以尝试从Gemfile和application.js中的
require
行中删除gem