Can not colour in background of 960.gs container - css

I'm using 960.gs (http://960.gs) as a CSS framework for my site and I'm trying to colour in the background of the .container_12 classes rather than my .grid_12 classes for the extra 10px I get on each side, giving the grid a bit of whitespace to breathe.
I looked at the 960.gs example site and he has a background repeating on the y-axis and it seems to expand no matter how large or what is inside the .grid_12 or .grid_16 classes.
When I want to paint the background white (instead of have an image repeat on the y-axis), it appears as though my .grid_12 is floating and therefore .container_12 has no height and thus, no white background.
Here is my relevant HTML
<body>
<div id="logoContainer" class="container_12">
<div id="logo" class="grid_12">
<h1>Logo</h1>
</div> <!-- end #logo -->
</div> <!-- end #logoContainer -->
<div class="clear"></div>
<div id="menuContainer" class="container_12">
<div id="menu" class="grid_12">
<ul>
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
<li>Link 4</li>
</ul>
</div> <!-- end #menu -->
</div> <!-- end #menuContainer -->
<div class="clear"></div>
<div id="contentContainer" class="container_12">
<div id="content" class="grid_12">
<p>Content here</p>
</div> <!-- end #content -->
</div> <!-- end #contentContainer -->
<div class="clear"></div>
</body>
and CSS
/* 960.gs */
#import url('reset.css');
#import url('960.css');
#import url('text.css');
#contentContainer
{
background-color: #fff;
margin-bottom: 10px;
border-radius: 20px;
-o-border-radius: 20px;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
}

To answer my own question, the <div class="clear"></div> need to be after each .grid_, not each .container_

Related

How to move a div containing a image

I cant seem to move the image inside a div. It can only be moved with absolute positioning, which I am not okay with. Can someone point out why the below given code isnt working. I want all 3 divs to be in one line . Image seems to be stuck in the top left corner. Applying padding doesnt change anything either.Please help
<div class="container" style="display:table">
<div style="display:table-cell">
<div class="emblem" style="padding:0 0 0 20px ;display:table-cell"></div>
<div class="logo" style="display:table-cell" Software Solutions</div>
</div>
<div class="header" style="">
<nav>
<ul style="display:flex;justify-content">
<li> Home</li>
<li>
<a href="{% url 'aboutus' %}" target="ifr" onclick="setTitle2()">
<title>RCE-About</title>About Us</a>
</li>
<li>Products</li>
<li>Solutions</li>
<li>Support</li>
</ul>
</nav>
</div>
</div>
It's maybe something like this you need to do..
EDIT:edited snippet code, navbar is under logo but take 100% width
.container{
display:flex;
justify-content: flex-start;
flex-wrap:wrap;
background:gray;
padding:5px;
}
.navbar-container{
width:100%
}
.container > div{
display:block;
height: 50px;
background: red;
margin-right: 15px;
padding:15px;
text-align:center;
}
ul{
margin:0;
padding:0;
}
ul li{
display:inline-block;
}
<div class="container">
<div class="1">Some text</div>
<div class="logo">LOGO</div>
<div class="navbar-container">
<div class="navbar">
<ul>
<li>test1</li>
<li>test2</li>
<li>test3</li>
</ul>
</div>
</div>
</div>

pseudoelement works in Firefox but not Chrome, why?

I am trying to use a pseudoelement to replace the <li> for <ul> with a triangle. I followed this tutorial.
The problem is that my CSS works in Firefox but not Chrome on Windows.
Here is my CSS:
article ul {
list-style: none;
}
article ul > li::before {
font-family: FontAwesome;
content: "\f0da";
color: $darkbrown;
display: inline-block;
width: 1em;
margin-left: -1em
}
I am targeting article because I have <ul> in the header and footer that I do not want to apply the triangle to.
In Firefox, this works as expected (<ul> in the article have the triangle, and <ol> in the article show numbers). However, in Chrome, the <ul> in the article have a triangle, but the <ol> in the article also have triangles.
Here's an example of the HTML (sorry, it's from Drupal and a little ugly; I cleaned it up as best I could):
<body class="path-node page-node-type-lp navbar-is-static-top has-glyphicons">
<a href="#main-content" class="visually-hidden focusable skip-link">
メインコンテンツに移動
</a>
<div role="main" class="main-container container js-quickedit-main-content">
<div class="row">
<div class="col-sm-12" role="heading">
<section class="col-sm-12">
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-10 col-xs-12">
<a id="main-content"></a>
<div class="region region-content">
<article role="article" about="/myurl" class="lp full clearfix">
<div class="content">
<div class="layout layout--onecol">
<div class="layout__region layout__region--content">
<section
class="block block-layout-builder block-field-blocknodelpbody clearfix">
<div class="field field--name-body field--type-text-with-summary field--label-hidden field--item">
<ol>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ol>
</div>
</section>
</div>
</div>
</div>
</article>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
</body>
I'm not sure i'm understanding your issue as your code appears to work the way you intend. I've added a <ul> inside your <article> to show that it has a triangle next to it while the <ol> shows the default numbering. Try browsing this example in Chrome to see the results.
article ul {
list-style: none;
}
article ul>li::before {
font-family: FontAwesome;
content: "\f0da";
color: red;
display: inline-block;
width: 1em;
margin-left: -1em
}
<a href="#main-content" class="visually-hidden focusable skip-link">
メインコンテンツに移動
</a>
<div role="main" class="main-container container js-quickedit-main-content">
<div class="row">
<div class="col-sm-12" role="heading">
<section class="col-sm-12">
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-10 col-xs-12">
<a id="main-content"></a>
<div class="region region-content">
<article role="article" about="/myurl" class="lp full clearfix">
<div class="content">
<div class="layout layout--onecol">
<div class="layout__region layout__region--content">
<section class="block block-layout-builder block-field-blocknodelpbody clearfix">
<div class="field field--name-body field--type-text-with-summary field--label-hidden field--item">
<ol>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ol>
<ul>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ul>
</div>
</section>
</div>
</div>
</div>
</article>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
I finally found the problem, which related to inlining critical css using the Drupal CriticalCSS module.
Basically, what happened is that I had generated the critical CSS based on old CSS, and this inline css (the critical CSS) was overriding the working CSS in the file I was editing.
Apparently, Firefox gives priority to the non-inline CSS, while Chrome and Edge prioritize the inline CSS, hence the reason for the difference in what was displayed.
Lesson learned: Make sure any inline CSS is current when editing CSS. (I am looking in to ways to automate that right now.)

Bootstrap - Divs in a row are causing shift/jump effect

I have a page developed using twitter bootstrap version 2. I have a row that is divided into span8 and span4. Span8 has some image slider (built with jquery) and span4 has just some links. When the page loads, all the links in the span 4 is displayed first and then when the image loads, the text gets pushed to right. Is there a way to prevent this shift/jump effect?
<div class="row-fluid">
<div class="span8" id="imgDiv">
<!-- Image slider goes here -->
</div>
<div class="span4" id="linksDiv">
<ul>
<li>link1</li>
<li>link2</li>
<li>link3</li>
</ul>
</div>
</div>
I have devised the following solution. Here's a JSFiddle: http://jsfiddle.net/sJq6y/
HTML
<div class="container">
<div class="row-fluid">
<div class="span8">
<div class="imgDiv">
<h1> Image slider goes here </h1>
</div>
</div>
<div class="span4 linksDiv">
<ul>
<li>Link One
</li>
<li>Link Two
</li>
<li>Link Duo
</li>
</ul>
</div>
</div>
</div>
CSS
.linksDiv ul {
list-style:none;
background-color:lightgrey;
width:90px;
height:90px;
padding:10px;
}
.imgDiv h1 {
text-align:center;
color:tomato;
}
Images
Probably due to styling coming from #imgDiv and #linksDiv.
Would this option work for you?
<div class="row-fluid">
<div class="span8">
<div id="imgDiv">
<!-- Image slider goes here -->
</div> <!-- end #imgDiv -->
</div>
<div class="span4">
<div id="linksDiv">
<ul>
<li>link1</li>
<li>link2</li>
<li>link3</li>
</ul>
</div> <!-- end #linksDiv -->
</div>
</div>
Good luck!

twitter bootstrap: How to span links in the navbar?

I've tried a few option but i can't manage to get 4 links to span across the navbar. I thought it would be quite easy to add the span3 class to each <li>.
Here's my HTML:
<div class="navbar center">
<div class="navbar-inner">
<div class="container row">
<ul class="nav span12">
<li class="active span3">
Home
</li>
<li class="span3">Link</li>
<li class="span3">Link</li>
<li class="span3">Link</li>
</ul>
</div>
</div>
</div>
To center the links I've used the solution described here: Modify twitter bootstrap navbar
Here's the CSS:
.navbar-inner {
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}
.center.navbar .nav,
.center.navbar .nav > li {
float:none;
display:inline-block;
*display:inline; /* ie7 fix */
*zoom:1; /* hasLayout ie7 trigger */
vertical-align: top;
}
.center .navbar-inner {
text-align:center;
}
All I've managed to get is this:
How can I get those four links spanned on the same row?
Using spanX is not the best solution here (unless you're using bootstrap-resonsive.css, see below). You can uses percentages, as long as you're willing to modify you CSS when the number of items in the navbar changes.
You can make this work with default navbar markup:
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<ul class="nav">
<li>Home</li>
<li>Link</li>
<li>Link</li>
</ul>
</div>
</div>
</div>
And two CSS rules. The first removes the margin on the <ul class="nav">, removes the float and sets its width to be 100% of its container (in this case, the <div class="container"> within <div class="navbar-inner">.
The second rule sets the width of each <li> to be a certain percentage of the width of the <ul>. If you have four items, then set it to 25%. If you have five, it'd be 20%, and so on.
.navbar-inner ul.nav {
margin-right: 0;
float: none;
width: 100%;
}
.navbar-inner ul.nav li {
width: 33%;
text-align: center;
}
jsFiddle DEMO
UPDATE
If you are using the responsive bootstrap CSS, you CAN use the built-in spanX classes, like so:
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<ul class="nav row-fluid">
<li class="span4">Home</li>
<li class="span4">Link</li>
<li class="span4">Link</li>
</ul>
</div>
</div>
</div>
Then, all the CSS you need is:
.navbar-inner ul.nav li {
text-align: center;
}
jsFiddle DEMO
You did a good start but your markup doesn't reflect the real grid :
You don't put .spanX in a .span12
.container and .row might have conflicting properties
It seems to work with this :
<div class="navbar center">
<div class="navbar-inner">
<div class="container">
<div class="row">
<ul class="nav">
<li class="active span3">
Home
</li>
<li class="span3">Link</li>
<li class="span3">Link</li>
<li class="span3">Link</li>
</ul>
</div>
</div>
</div>
</div>
Demo (jsfiddle) and fullscreen

960 gs, full width backgrounds

I'm trying to implement a design I created in photoshop. I want to use the 16 column 960 GS, but the problem is that I only want the content bound by the 960 width.
I have backgrounds for 4 seperate areas. Header, the content area, a top footer that is links, and the bottom footer with the copyright in it.
The top half of the page works fine. The backgrounds show, the text is in the right place. The problem comes with the footer. If the data in the content area expands beyond the minimum height for the content area, the links in the top footer are pushed down, but the backgrounds remain stationary. I suspect this is because the content is all floating and doesn't push the background divs when the content expands.
How do I have a background that is full width while using 960 gs and make it so the footer slides down when the content expands?
Here's the basic wrapper for my site. I realize this may not work for what I want to do.
<body>
<div id="header">
<div class="container_16">
</div>
</div>
<div id="content">
<div class="container_16">
</div>
</div>
<div id="footer-top">
<div class="container_16">
</div>
</div>
<div id="copyright-footer">
<div class="container_16">
</div>
</div>
</body>
the 960 GS css is here: http://www.spry-soft.com/grids/grid.css?column_width=40&column_amount=16&gutter_width=20
My CSS - I've ommited the elements that have to do with specific content, as this is just about getting the layout right:
html, body
{
height: 100%;
}
body
{
color: #f7f3e7;
margin:0;
padding:0;
background-color: #f7f3e7;
line-height: 1.2em;
font-size: 0.8em;
font-family: Verdana, Arial, Sans-Serif;
}
#header
{
height: 100px;
margin:0;
padding:0;
background: #666666 url(content/images/Home-Header-Bg.jpg) repeat-x;
}
#content
{
min-height: 550px;
/*min-height: 546px;*/
margin:0;
padding:0;
background: #f7f3e7 url(content/images/Home-Content-Bg.jpg) repeat-x top;
}
#top-footer
{
font-size: .8em;
min-height: 188px;
margin:0;
padding: 6px 0 6px 0;
background: #a67c52 url(content/images/Top-Footer-Bg.jpg) repeat-x top;
}
#copyright-footer
{
height: 32px;
vertical-align: middle;
font-size: 0.8em;
line-height: 32px;
margin:0;
padding:0;
background: #976f46 url(content/images/Copyright-Footer-Bg.jpg) repeat-x;
}
header, content, footer-top, and copyright-footer all have the background set and height or minimumheight.
Really what I want is the header set at 100px tall. The copyright footer is a set 42px tall. The top footer is set at 200 px tall. I want the bottom of the copyright footer to always rest on the bottom of the page if the content area is short enough that the footer wouldn't touch the bottom of the page. If the content area expands, I want the footer to slide down. I want the backgrounds for all sections to be 100% - that is, however wide the browser is, but I want my content bound by the 960 grid system.
Any suggestions?
EDIT: added the CSS as requested
I would create a div called 'content' that would contain the other divs and make the other divs' position relative. The 'content' div would have the appropriate width for what you want to do. Also, for each column you can use the 'float' css property.
Just wrap the container classes with <div> tags and style those. Remember to add .clear divs after every "row" in the containers (even if you have only one "row"), or it will not work properly.
<div id="container">
<div class="container_16">
<div class="grid_16"><h1>Hello, World!</h1></div>
<div class="clear"></div> <!-- Important! -->
</div>
</div>
I figured it out. I needed to make my footer float.
The Markup:
<body marginwidth="0" marginheight="0 leftmargin="0" topmargin="0">
<div id="page-wrapper">
<div id="header" class="container_full">
<div class="container_16">
<div id="logo" class="grid_4 alpha"><img src="content/images/logo-beta.png" /></div>
<div class="grid_10 push_0">
<ul id="navigation" class="clearfix-header">
<li><a class="header-link" href="#">About</a>
<span class="sub-navigation">
<a class="sub-link" href="#">Info</a>, <a class="sub-link" href="#">Terms</a></li>
</span>
</li>
<li><a class="header-link" href="#">Account</a>
<span class="sub-navigation">
<a class="sub-link" href="#">Sign In</a>, <a class="sub-link" href="#">Sign Up</a>
</span>
</li>
</ul>
</div>
</div>
</div>
<div id="content" class="container_full">
<div class="container_16">
<div id="page-content" class="grid_16">Page Content</div>
</div>
</div>
<div id="footer">
<div id="top-footer">
<div class="container_16">
<div class="grid_3">
<h4>Navigation</h4>
<ul>
<li>Sample Link</li>
<li>Sample Link</li>
<li>Sample Link</li>
<li>Sample Link</li>
<li>Sample Link</li>
<li>Sample Link</li>
</ul>
</div>
<div class="grid_3">
<h4>Navigation</h4>
<ul>
<li>Sample Link</li>
<li>Sample Link</li>
<li>Sample Link</li>
<li>Sample Link</li>
<li>Sample Link</li>
<li>Sample Link</li>
</ul>
</div>
<div class="grid_7">
Big content area
</div>
<div class="grid_3">
<h4>Boring Stuff</h4>
<ul>
<li>Terms of Use</li>
<li>Privacy Policy</li>
<li>Legal Mumbo-jumbo</li>
</ul>
</div>
</div>
</div>
<div id="copyright-footer">
<div class="container_16">
<div class="grid_16">
Copyright statement
</div>
</div>
</div>
</div>
</div>
</body>
The CSS:
#footer
{
width:100%;
float: left;
height: 232px;
position: relative;
clear:both;
}
#top-footer
{
width:100%;
font-size: .8em;
height: 200px;
margin:0;
padding: 6px 0 6px 0;
background: #a67c52 url(content/images/Top-Footer-Bg.jpg) repeat-x top;
}
#copyright-footer
{
width:100%;
height: 32px;
vertical-align: middle;
font-size: 0.8em;
line-height: 32px;
margin:0;
padding:0;
background: #976f46 url(content/images/Copyright-Footer-Bg.jpg) repeat-x;
}

Resources