Django18初体验


1227 浏览 5 years, 3 months

24 CSS WITH BLOCKS

版权声明: 转载请注明出处 http://www.codingsoho.com/

Style

In base.html

    <style>
    {% block style %}{% endblock %}
    </style>

Extend in home.html

<style>
{% block style %}

.text-align-center {
    text-align: center;
}
.navbar-static-top {
    margin-bottom: 0px !important;
}
{% endblock %}
</style>

text-align-center can also be moved to css\custom.css

同时在head_css.html添加

<link href="{% static 'css/custom.css' %}" rel="stylesheet">

{% block content %}
    <div class="row">
        <div class=" col-sm-3  pull-right">
            <p class='lead text-align-center'>{{ title }}</p>
            <form method="POST" action=''> {% csrf_token%}
            {{ form|crispy }}
            <input type="submit" value="sign up">
            </form>
        </div>  
        <div class='col-sm-3'>
            <p class='lead text-align-center'>Django & Bootstrap</p>
        </div>
        <div class='col-sm-3'>
            <p class='lead text-align-center'>Created for Starters 
            <br/>
            </p>
        </div>
        <div class='col-sm-3'>
            <p class='lead text-align-center'>Always Open Source <br/><br/>
            </p>
        </div>  
    </div>
{% endblock%}