Domanda

I'm using a CMS theme that contains all of Bootstrap 3. Is it possible to add a title block manually in HTML/CSS? I'm not sure if that's the block's official name... it's the purple full-width block containing the text:

CSS Global CSS settings, fundamental HTML elements styled and enhanced with extensible classes, and an advanced grid system.

in the following link (for example):

http://getbootstrap.com/css/

This title block is built into my theme and is available based on the design for the page I select.

But I was wondering if this block is available separately from Bootstrap, like a Navbar, panel, well, etc. component, that I can just include some HTML/CSS code and have it appear in the body of a page, for example.

È stato utile?

Soluzione

No it's not in bootstrap but it's pretty easy to grab the style and use it anywhere:

.bs-docs-header {
font-size: 24px;
padding-bottom: 60px;
padding-top: 60px;
text-align: left;
}

.bs-docs-masthead, .bs-docs-header {
background-color: #6F5499;
background-image: linear-gradient(to bottom, #563D7C 0px, #6F5499 100%);
background-repeat: repeat-x;
color: #CDBFE3;
padding: 30px 15px;
position: relative;
text-align: center;
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);

}

check this jsfiddle

Altri suggerimenti

If you look at their source, they are using a stylesheet called docs.min.css, they have defined the background in here. Other then that it is just a simple <div class="container"><!--title and subtitle here-->. So the answer is a yes and a no. You can, of course, use containers seperately from your CMS when using bootstrap, but the background will not be available unless you strip it from the getbootstrap.com source.


Edit

If you see their styles, they are using this code in their docs.min.css:

@media (min-width: 768px)
    .bs-docs-header h1 {
    font-size: 60px;
    line-height: 1;
    }
}

This means, when the width of your window is above 768 pixels, it gives the h1 a font-size of 60px. When you fall under it, this code is ignored and the default bootstrap font-size is being applied.


Edit 2

To get a background-color behind it, don't apply the background color to the .container. wrap a div around it without a width value. The container width is not full width, so if you apply a background to it, its only behind the container that is centered.


Edit 3

A simple HTML structure would be something like this (you still have to include all bootstrap styles and default html tags etc.

<html>
    <body>
        <div id="bgColorDiv">
            <div class="container">
                <h1>My title</h1>
                <p>Paragraph below the title</p>
            </div>
        </div>
    </body>
</html>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top