I’d like to use Twitter Bootstrap for one project which has a bit of a crazy layout.
The logo’s background should start from the edge of the window, but the text in the logo should start where the .container
begins.
Crazy, huh!
I’m not sure how to explain this so I drew it!
What I’ve done so far is this:
<div class="container">
<header>
<div id="logo" class="pull-left col-sm-3 bg-theme">
<div class="typography">
Dope
<br/>
Text
</div>
</div>
<div class="col-sm-9">
<nav class="pull-right"> nav should be here </nav>
</div>
</header>
<!-- header -->
</div>
#logo {
position: relative;
height: 100px;
background: #ffd800;
}
.typography {
position: absolute;
right: 0px;
top: 20px;
line-height: 50px;
font-size: 50px;
font-weight: bold;
}
I created a demo@jsFiddle.
How should I structure my HTML, or what can I do with the CSS to achieve this effect.
CSS only solutions if possible.
Edit: Those kind of title element might appear on the page again, so solutions which are based on the fact that the element will be at the top of the page are not what I’m after.
6
Answers
would something like this work? http://jsfiddle.net/swm53ran/312/
if you want to see how the structure could happen over and over again, you could just add the sectioned off divs like in this fiddle: http://jsfiddle.net/swm53ran/313/
Use the grid system to isolate header and body:
Use
.container-fluid
for the content you want to be full width instead of the fixed-width that comes with.container
.Per Bootstrap:
.container
(fixed-width) or.container-fluid
(full-width) for proper alignment and padding.If you want
container-fluid
to go the absolute edge of the window, you can setpadding: 0;
like:Here’s a fiddle demo for you to review. http://jsfiddle.net/xsqezfro/ (I put a border around
.container
so you can see the div.I recommend making the following changes.
.container-fluid
.container
into your.container-fluid
.container
, but inside your.container-fluid
Once complete it should look something like.
First of all you have to take into account Grid System Rules:
So following the above rules you can achieve what you want like this:
Here a working JSFiddle fork from yours
You can change the # in col-xs-X as you wish to obtain your desire layout but always trying to follow the above rules.