在Bootstrap中正确设置样式字体大小

时间:2016-02-21 10:58:27

标签: twitter-bootstrap twitter-bootstrap-3

我的标题是我的字体大小。

当浏览器窗口调整大小时,相同的h2标题突然与我的h1标题一样大,这似乎在我的Jumbotron中嵌套div的效果受到挤压

如何解决此问题(因此我的h1仍然是最大的字体,并且greenpromobox div在浏览器调整大小时不会被压扁?)

实例:http://185.123.96.102/~kidsdrum/moneynest.co.uk/

HTML代码:

<div class="special">
    <div class="jumbotron">
        <div class="container text-center">
            <div class="h1extrapadding hidden-xs hidden-sm"></div>  
            <h1 class="boldme">
                Aged 20-30 & frustrated with money?
            </h1> 
            <div class="greenpromobox">
                <div class="h2extrapadding hidden-xs hidden-sm"></div>
                <h2 class="boldme">
                    Take our free <b class="jumpstarttext">Jumpstart Your Finances</b> class to<br /> quickly gain control over your finances
                </h2>


                <!-- Begin MailChimp Signup Form -->
                <div id="mc_embed_signup">
                    <form action="//moneynest.us11.list-manage.com/subscribe/post?u=9ccf2d2219536b32eaae3c3d1&amp;id=299de51b4e" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
                        <div id="mc_embed_signup_scroll">
                            <img src="http://185.123.96.102/~kidsdrum/moneynest.co.uk/img/hand-drawn-arrow.png" id="handarrow" class="hidden-xs hidden-sm" alt="arrow"><input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="Enter your email address" required autofocus>
                            <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
                            <div style="position: absolute; left: -5000px;" aria-hidden="true">
                                <input type="text" name="b_9ccf2d2219536b32eaae3c3d1_299de51b4e" tabindex="-1" value="">
                            </div>
                            <div class="clear">
                                <input type="submit" value="Start Class Now" name="subscribe" id="mc-embedded-subscribe" class="text-uppercase btn btn-primary btn-lg">
                            </div>
                        </div>
                    </form>
                </div>

                <!--End mc_embed_signup-->

            </div>
        </div>
    </div>
</div>

萨姆

1 个答案:

答案 0 :(得分:0)

尝试使用媒体查询并在每个查询中设置您选择的字体大小。

/* Extra small devices (phones, up to 480px) */
@media screen and (max-width: 767px) {
  h1{
    font-size:1em;
}
}
/* Small devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991px) {
  h1{
    font-size:2em;
}
}
/* tablets/desktops and up ----------- */
@media (min-width: 992px) and (max-width: 1199px) {
  h1{
    font-size:3em;
}
}
/* large desktops and up ----------- */
@media screen and (min-width: 1200px) {
}
<h1>Hello</h1>