A
A
Alino4ka2017-05-28 10:48:56
Node.js
Alino4ka, 2017-05-28 10:48:56

Why after extends in jade the main content is inserted after closing body/html tags?

header.jade

doctype html
html(lang='en')
  head
    meta(charset='utf-8')
    meta(http-equiv='X-UA-Compatible', content='IE=edge')
    meta(name='viewport', content='width=device-width, initial-scale=1')
    title Title
    link(rel='stylesheet', href='bootstrap.min.css')
  body
    .navbar.navbar-default.navbar-fixed-top(role='navigation')
      .container
        .navbar-header
          button.navbar-toggle(type='button', data-toggle='collapse', data-target='.navbar-collapse')
            span.sr-only Открыть меню
            span.icon-bar
            span.icon-bar
            span.icon-bar
          a.navbar-brand(href='#') Logo
        .navbar-collapse.collapse
          ul.nav.navbar-nav
            li.active
              a(href='#') Создать
            li
              a(href='#') Добавить
            li
              a(href='#') FAQ
          ul.nav.navbar-nav.navbar-right
            li
              a(href='#') Войти
            li
              a(href='#') Регистрация
block head

index.jade
extends header
block head
  .jumbotron.main-jumbotron
    .container
      .col-md-8

At the output I get:
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Title</title>
    <link rel="stylesheet" href="bootstrap.min.css">
</head>

<body>
    <div role="navigation" class="navbar navbar-default navbar-fixed-top">
        <div class="container">
            <div class="navbar-header"><button type="button" data-toggle="collapse" data-target=".navbar-collapse" class="navbar-toggle"><span class="sr-only">Открыть меню</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a href="#" class="navbar-brand">Logo</a></div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li class="active"><a href="#">Создать</a></li>
                    <li><a href="#">Добавить</a></li>
                    <li><a href="#">FAQ</a></li>
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    <li><a href="#">Войти</a></li>
                    <li><a href="#">Регистрация</a></li>
                </ul>
            </div>
        </div>
    </div>
</body>

</html>
<div class="jumbotron main-jumbotron">
    <div class="container">
        <div class="col-md-8"></div>
    </div>
</div>

what am i doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dummyman, 2017-05-28
@Alino4ka

because the block head in header.jade is level behind the html. add a couple of tabs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question