Skeleton CSS classes grids - css

I'm creating a grid system in wordpress using Skeleton.css
The tutorial shows the following markup for the header, here you can see the logo has has a 3 classes, - five columns and clearfix
<header>
<div class="five columns clearfix">
get_template_directory_uri(); ?>/img/logo.svg"></a>
</div>
</header>
But when I look at the skellton css I cannot see a class of 'five' So i changed it to .five.columns But his make no difference, I i create a border around the class .five.columns, it does not show up am I missing something obvious?
.one.column,
.one.columns { width: 4.66666666667%; }
.two.columns { width: 13.3333333333%; }
.three.columns { width: 22%; }
.four.columns { width: 30.6666666667%; }
.five.columns { width: 39.3333333333%; }
.six.columns { width: 48%; }
.seven.columns { width: 56.6666666667%; }
.eight.columns { width: 65.3333333333%; }
.nine.columns { width: 74.0%; }
.ten.columns { width: 82.6666666667%; }
.eleven.columns { width: 91.3333333333%; }
.twelve.columns { width: 100%; margin-left: 0; }
.one-third.column { width: 30.6666666667%; }
.two-thirds.column { width: 65.3333333333%; }
.one-half.column { width: 48%; }
/* Offsets */
.offset-by-one.column,
.offset-by-one.columns { margin-left: 8.66666666667%; }
.offset-by-two.column,
.offset-by-two.columns { margin-left: 17.3333333333%; }
.offset-by-three.column,
.offset-by-three.columns { margin-left: 26%; }
.offset-by-four.column,
.offset-by-four.columns { margin-left: 34.6666666667%; }
.offset-by-five.column,
.offset-by-five.columns { margin-left: 43.3333333333%; }
.offset-by-six.column,
.offset-by-six.columns { margin-left: 52%; }
.offset-by-seven.column,
.offset-by-seven.columns { margin-left: 60.6666666667%; }
.offset-by-eight.column,
.offset-by-eight.columns { margin-left: 69.3333333333%; }
.offset-by-nine.column,
.offset-by-nine.columns { margin-left: 78.0%; }
.offset-by-ten.column,
.offset-by-ten.columns { margin-left: 86.6666666667%; }
.offset-by-eleven.column,
.offset-by-eleven.columns { margin-left: 95.3333333333%; }
.offset-by-one-third.column,
.offset-by-one-third.columns { margin-left: 34.6666666667%; }
.offset-by-two-thirds.column,
.offset-by-two-thirds.columns { margin-left: 69.3333333333%; }
.offset-by-one-half.column,
.offset-by-one-half.columns { margin-left: 52%; }
}
/* Larger than mobile */
#media (min-width: 400px) {}
Many thanks

Here is a fiddle with some styling for height and color to make it obvious. Is your div 0px height? Check it with your developer tools in the browser - Chrome Developer Tools website.
https://jsfiddle.net/p1w61hmt/.
<header style="height: 100px; background: green;">
<div class="five columns clearfix" style="height: 100%;">
</div>
</header>
.five.columns { width: 39.3333333333%; }
.columns { background: red; }
Its probably some pasting errors but your HTML is not valid and your css looks like an incomplete snippet.

Related

SCSS: Why Parent Child selector syntax does not apply styles?

Markup:
<div class="form">
<div class="form-row">
<div class="text-field">
/* I want to apply styles for this div */
</div>
</div>
</div>
scss styles:
.form {
&-row {
// WHY this doesn't work
.text-field {
width: 20%;
}
// WHY this doesn't work
div.text-field {
width: 20%;
}
// WHY this doesn't work
& .text-field {
width: 20%;
}
// This works. I don't want this syntax.
div[class^='text-field'] {
width: 20%;
}
}
}
all options are work correctly...
i just check using background color :
.form {
&-row {
// WHY this doesn't work
.text-field {
width : 20%;
background-color: red;
}
// WHY this doesn't work
div.text-field {
width : 20%;
background-color: red;
}
// WHY this doesn't work
& .text-field {
width : 20%;
background-color: red;
}
// This works. I don't want this syntax.
div[class^='text-field'] {
width : 20%;
background-color: red;
}
}
}

Generating column classes with dynamic width using SASS

I was trying to generate a dynamic grid system using SASS with variable widths using a #for loop. So far I have :
#for $value from 1 through 12 {
$width: percentage(1/$value);
.col-md-#{$value} {
width: $width;
}
}
The output for the above code would be:
.col-md-1 {
width: 100%;
}
.col-md-2 {
width: 50%;
}
.
.
.
.col-md-11 {
width: 9.09091%;
}
.col-md-12 {
width: 8.33333%;
}
Is there anyway this could be reversed by tinkering with the percentage functions in such a way that:
.col-md-12 {
width: 100%;
}
and
.col-md-1 {
width: 8.33333%;
}
The opposite of what I currently have. Thanks in advance.
A simple change to the math should do the trick:
#for $value from 1 through 12 {
$width: percentage($value/12);
.col-md-#{$value} {
width: $width;
}
}
results in:
.col-md-1 {
width: 8.33333%;
}
.col-md-2 {
width: 16.66667%;
}
.col-md-3 {
width: 25%;
}
.col-md-4 {
width: 33.33333%;
}
.col-md-5 {
width: 41.66667%;
}
.col-md-6 {
width: 50%;
}
.col-md-7 {
width: 58.33333%;
}
.col-md-8 {
width: 66.66667%;
}
.col-md-9 {
width: 75%;
}
.col-md-10 {
width: 83.33333%;
}
.col-md-11 {
width: 91.66667%;
}
.col-md-12 {
width: 100%;
}

Bootstrap 2 column issues when using mixins

I am using Bootstrap 2 mixins .makeRow() and .makeColumn() to make columns 4,3 and 5 which equals to a full row span 12 width. But it doesnt get applied properly. This is a screenshot of what I get.
Markup:
<div class="calculators-form-field credit-amount">
<div class="calculators-labels">
<label>Your monthly budget <i class="label-tooltip icon-info-sign glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="top" title="" data-original-title="Tooltip"></i>
<a class="calculators-helper-link" href="#" data-toggle="modal" data-target="#budgetCalModal">(Help me)</a>
</label>
</div>
<div class="calculators-sliders">
<input type="range" value="0" min="50" max="5000" step="50" tabindex="-1" data-bind="value: monthlyBudget">
</div>
<div class="calculators-inputs">
<div class="input-group input-prepend">
<span class="input-group-addon add-on">$</span>
<input name="monthlyBudget" class="form-control" type="text" placeholder="0" required="" data-bind="number, live: monthlyBudget" data-parsley-min="50" data-parsley-max="5000" data-parsley-validation-threshold="1" data-parsley-trigger="keyup" data-parsley-errors-container="#affordabilityCalErrorBudget">
</div>
</div>
<div class="calculators-inputs-error" id="affordabilityCalErrorBudget"></div>
</div>
Less:
.calculators-form-field {
.makeRow();
margin-bottom: 10px;
.calculators-labels {
.makeColumn(3);
.calculators-sliders {
input[type='range'] {
width: 100%;
}
.makeColumn(4);
}
}
.calculators-inputs {
.makeColumn(5);
}
}
Can anyone tell me how to fix this?
Firstly notice that you can not compile Bootstrap 2 with the latest version of Less without modifications, see: Less v2 does not compile Twitter's Bootstrap 2.x
Secondly i think #seven-phases-max is right;
#import "bootstrap3/bootstrap-2.3.2/less/bootstrap.less";
.calculators-form-field {
.makeRow();
margin-bottom: 10px;
.calculators-labels {
.makeColumn(3);
}
.calculators-sliders {
input[type='range'] {
width: 100%;
}
.makeColumn(4);
}
.calculators-inputs {
.makeColumn(5);
}
}
Compiles into CSS as follows:
.calculators-form-field {
margin-left: -20px;
*zoom: 1;
margin-bottom: 10px;
}
.calculators-form-field:before,
.calculators-form-field:after {
display: table;
content: "";
line-height: 0;
}
.calculators-form-field:after {
clear: both;
}
.calculators-form-field .calculators-labels {
float: left;
margin-left: 20px;
width: 220px;
}
.calculators-form-field .calculators-sliders {
float: left;
margin-left: 20px;
width: 300px;
}
.calculators-form-field .calculators-sliders input[type='range'] {
width: 100%;
}
.calculators-form-field .calculators-inputs {
float: left;
margin-left: 20px;
width: 380px;
}
The above CSS code seems to work well for the default 940px grid, see also:
http://codepen.io/anon/pen/ogoyZW
In the situation that you use responsive grids the above does not work as expected. You can not reuse the .makeColumn() and .makeRow mixins due to https://github.com/less/less.js/issues/2435. You can try to create new mixins like that shown below:
.makeRow-responsive() {
.gutter(#GutterWidth) {
margin-left: #GutterWidth * -1;
}
.clearfix();
.gutter(#gridGutterWidth);
#media (min-width: 1200px) {
.gutter(#gridGutterWidth1200);
}
#media (min-width: 768px) and (max-width: 979px) {
.gutter(#gridGutterWidth768);
}
}
.makeColumn-responsive(#columns: 1, #offset: 0) {
.set(#width; #GutterWidth) {
margin-left: (#width * #offset) + (#GutterWidth * (#offset - 1)) + (#GutterWidth * 2);
width: (#width * #columns) + (#GutterWidth * (#columns - 1));
}
float: left;
.set(#gridColumnWidth;#gridGutterWidth);
#media (min-width: 1200px) {
.set(#gridColumnWidth1200,#gridGutterWidth1200);
}
#media (min-width: 768px) and (max-width: 979px) {
.set(#gridColumnWidth768,#gridGutterWidth768);
}
}
You can now call the above mixins as follows:
.calculators-form-field {
.makeRow-responsive();
margin-bottom: 10px;
.calculators-labels {
.makeColumn-responsive(3);
}
.calculators-sliders {
input[type='range'] {
width: 100%;
}
.makeColumn-responsive(4);
}
.calculators-inputs {
.makeColumn-responsive(5);
}
}
Example: http://www.bootply.com/CJtufRFlI2

Responsive CSS grid that doesn't rely on box-sizing

I tried to search for an answer to this both within Google, and on this website.
I have a website that needs to be made responsive. It's relatively intricate, but it's definitely possible with the design we currently have.
My question is this. Is there a responsive grid system, or an example of a fully responsive grid system that does NOT rely on box-sizing: border-box. After looking at Pure & Bootstrap, it seems both rely on that property to make it work.
When thinking about it in practice, it seems to me that a box-sizing:border-box model would be required to allow the use of percentages appropriately.
Why am I unable to use this method? Support of IE7 is absolutely required for this project. I know there are polyfills and htc files that can be used to force support, however, the scale and size of this site makes these options hard to implement. From what I've read, these options should be used in moderation, and a site of this caliber, it just couldn't be used in moderation.
Thanks.
In Twitter Bootstrap 3 you can remove the box-sizing in line 293.
*,
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
Just remove this and in input declaration :)
Here is an example of the Bootstrap 2.3.x grid only using it mobile first, it kicks in at the 768 min width, you can change this value. To get this to be seen by IE7 and IE8 use Respond.js and make sure you read their docs. Basically you need to locally link (relative path) to the CSS for Respond.js.
This does not rely on box-sizing:border-box.
#media (min-width: 768px) {
[class*="span"] {
float: left;
min-height: 1px;
margin-left: 20px;
}
.row {
width: 100%;
*zoom: 1;
}
.row:before,
.row:after {
display: table;
content: "";
line-height: 0;
}
.row:after { clear: both }
.row [class*="span"] {
display: block;
width: 100%;
min-height: 30px;
float: left;
margin-left: 2.7624309392265194%;
*margin-left: 2.709239449864817%;
}
.row [class*="span"]:first-child { margin-left: 0 }
[class*="span"].pull-right,
.row [class*="span"].pull-right { float: right }
.row .span12 { width: 100% }
.row .span11 { width: 91.43646408839778% }
.row .span10 { width: 82.87292817679558% }
.row .span9 { width: 74.30939226519337% }
.row .span8 { width: 65.74585635359117% }
.row .span7 { width: 57.18232044198895% }
.row .span6 { width: 48.61878453038674% }
.row .span5 { width: 40.05524861878453% }
.row .span4 { width: 31.491712707182323% }
.row .span3 { width: 22.92817679558011% }
.row .span2 { width: 14.3646408839779% }
.row .span1 { width: 5.801104972375691% }
.row .offset12 { margin-left: 105.52486187845304% }
.row .offset12:first-child { margin-left: 102.76243093922652% }
.row .offset11 { margin-left: 96.96132596685082% }
.row .offset11:first-child { margin-left: 94.1988950276243% }
.row .offset10 { margin-left: 88.39779005524862% }
.row .offset10:first-child { margin-left: 85.6353591160221% }
.row .offset9 { margin-left: 79.8342541436464% }
.row .offset9:first-child { margin-left: 77.07182320441989% }
.row .offset8 { margin-left: 71.2707182320442% }
.row .offset8:first-child { margin-left: 68.50828729281768% }
.row .offset7 { margin-left: 62.70718232044199% }
.row .offset7:first-child { margin-left: 59.94475138121547% }
.row .offset6 { margin-left: 54.14364640883978% }
.row .offset6:first-child { margin-left: 51.38121546961326% }
.row .offset5 { margin-left: 45.58011049723757% }
.row .offset5:first-child { margin-left: 42.81767955801105% }
.row .offset4 { margin-left: 37.01657458563536% }
.row .offset4:first-child { margin-left: 34.25414364640884% }
.row .offset3 { margin-left: 28.45303867403315% }
.row .offset3:first-child { margin-left: 25.69060773480663% }
.row .offset2 { margin-left: 19.88950276243094% }
.row .offset2:first-child { margin-left: 17.12707182320442% }
.row .offset1 { margin-left: 11.32596685082873% }
.row .offset1:first-child { margin-left: 8.56353591160221% }
}/* end min-width */

Twitter bootstrap with width > 1170px

This might be a stupid question, but after looking around the world wide webs for a while, I could not find an answer.
I'm using twitter bootstrap's fluid grid system for my new site. I mocked up the homepage's container area to be wider than twitter's default 1170px (1506px).
The 1506px layout breaks down to:
12 columns each 98px (1176px) with 11 margins of 30px (330px)
1176+300 = 1506.
So is there any way that I can just plug this width (1506) into twitter bootstrap without having to overhaul a bunch of LESS and CSS?
Looks like everything you need starts at line 111:
#media (min-width: 1200px) {
...
.container,
.navbar-static-top .container,
.navbar-fixed-top .container,
.navbar-fixed-bottom .container {
width: 1170px;
}
.span12 {
width: 1170px;
}
...
}
You can NOT use the customizer at http://getbootstrap.com/customize/ unless you drop and replace the 1200px grid.
Compile your own css will be the easiest way:
see: https://stackoverflow.com/a/12029786/1596547 and also Twitter Bootstrap Customization Best Practices
The example below set the min-width of this grid to 1536pixels (1536 x 864) grid width + gutter
fork twitter-bootstrap from github and clone locally
add your new 1536 variables to less/variables.less (before the 1200 variables, see below)
copy less/responsive-1200px-min.less to less/responsive-1536px-min.less "search and replace" 1200 with 1536:
import responsive-1536px-min.less #import "responsive-1536px-min.less"; in less/resposnive.less (before the 1200 include)
Install the LESS command line tool via Node and run the following command:$ lessc ./less/bootstrap.less > bootstrap.css
variables for step 2.:
// 1536px min
#gridColumnWidth1536: 98px;
#gridGutterWidth1536: 30px;
#gridRowWidth1536: (#gridColumns * #gridColumnWidth1536) + (#gridGutterWidth1536 * (#gridColumns - 1));
// 1536px min
#fluidGridColumnWidth1536: percentage(#gridColumnWidth1536/#gridRowWidth1536);
#fluidGridGutterWidth1536: percentage(#gridGutterWidth1536/#gridRowWidth1536);
Or not preferred create your own 1536 (1506) grid css and add it after the bootstrap css in your source.
1536.css:
/* based on Bootstrap v2.3.2 */
#media (min-width: 1536px) {
.row {
margin-left: -30px;
*zoom: 1;
}
.row:before,
.row:after {
display: table;
content: "";
line-height: 0;
}
.row:after {
clear: both;
}
[class*="span"] {
float: left;
min-height: 1px;
margin-left: 30px;
}
.container,
.navbar-static-top .container,
.navbar-fixed-top .container,
.navbar-fixed-bottom .container {
width: 1506px;
}
.span12 {
width: 1506px;
}
.span11 {
width: 1378px;
}
.span10 {
width: 1250px;
}
.span9 {
width: 1122px;
}
.span8 {
width: 994px;
}
.span7 {
width: 866px;
}
.span6 {
width: 738px;
}
.span5 {
width: 610px;
}
.span4 {
width: 482px;
}
.span3 {
width: 354px;
}
.span2 {
width: 226px;
}
.span1 {
width: 98px;
}
.offset12 {
margin-left: 1566px;
}
.offset11 {
margin-left: 1438px;
}
.offset10 {
margin-left: 1310px;
}
.offset9 {
margin-left: 1182px;
}
.offset8 {
margin-left: 1054px;
}
.offset7 {
margin-left: 926px;
}
.offset6 {
margin-left: 798px;
}
.offset5 {
margin-left: 670px;
}
.offset4 {
margin-left: 542px;
}
.offset3 {
margin-left: 414px;
}
.offset2 {
margin-left: 286px;
}
.offset1 {
margin-left: 158px;
}
.row-fluid {
width: 100%;
*zoom: 1;
}
.row-fluid:before,
.row-fluid:after {
display: table;
content: "";
line-height: 0;
}
.row-fluid:after {
clear: both;
}
.row-fluid [class*="span"] {
display: block;
width: 100%;
min-height: 30px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
float: left;
margin-left: 1.9920318725099602%;
*margin-left: 1.9388403831482581%;
}
.row-fluid [class*="span"]:first-child {
margin-left: 0;
}
.row-fluid .controls-row [class*="span"] + [class*="span"] {
margin-left: 1.9920318725099602%;
}
.row-fluid .span12 {
width: 100%;
*width: 99.94680851063829%;
}
.row-fluid .span11 {
width: 91.50066401062416%;
*width: 91.44747252126245%;
}
.row-fluid .span10 {
width: 83.00132802124833%;
*width: 82.94813653188662%;
}
.row-fluid .span9 {
width: 74.5019920318725%;
*width: 74.4488005425108%;
}
.row-fluid .span8 {
width: 66.00265604249668%;
*width: 65.94946455313497%;
}
.row-fluid .span7 {
width: 57.503320053120845%;
*width: 57.450128563759144%;
}
.row-fluid .span6 {
width: 49.00398406374502%;
*width: 48.95079257438332%;
}
.row-fluid .span5 {
width: 40.504648074369186%;
*width: 40.451456585007485%;
}
.row-fluid .span4 {
width: 32.005312084993356%;
*width: 31.952120595631655%;
}
.row-fluid .span3 {
width: 23.50597609561753%;
*width: 23.45278460625583%;
}
.row-fluid .span2 {
width: 15.006640106241699%;
*width: 14.953448616879998%;
}
.row-fluid .span1 {
width: 6.507304116865869%;
*width: 6.454112627504167%;
}
.row-fluid .offset12 {
margin-left: 103.98406374501992%;
*margin-left: 103.8776807662965%;
}
.row-fluid .offset12:first-child {
margin-left: 101.99203187250995%;
*margin-left: 101.88564889378654%;
}
.row-fluid .offset11 {
margin-left: 95.48472775564409%;
*margin-left: 95.37834477692067%;
}
.row-fluid .offset11:first-child {
margin-left: 93.49269588313412%;
*margin-left: 93.3863129044107%;
}
.row-fluid .offset10 {
margin-left: 86.98539176626825%;
*margin-left: 86.87900878754483%;
}
.row-fluid .offset10:first-child {
margin-left: 84.99335989375828%;
*margin-left: 84.88697691503486%;
}
.row-fluid .offset9 {
margin-left: 78.48605577689243%;
*margin-left: 78.37967279816901%;
}
.row-fluid .offset9:first-child {
margin-left: 76.49402390438246%;
*margin-left: 76.38764092565904%;
}
.row-fluid .offset8 {
margin-left: 69.9867197875166%;
*margin-left: 69.88033680879319%;
}
.row-fluid .offset8:first-child {
margin-left: 67.99468791500664%;
*margin-left: 67.88830493628322%;
}
.row-fluid .offset7 {
margin-left: 61.48738379814077%;
*margin-left: 61.38100081941736%;
}
.row-fluid .offset7:first-child {
margin-left: 59.49535192563081%;
*margin-left: 59.388968946907404%;
}
.row-fluid .offset6 {
margin-left: 52.98804780876495%;
*margin-left: 52.88166483004154%;
}
.row-fluid .offset6:first-child {
margin-left: 50.996015936254985%;
*margin-left: 50.88963295753158%;
}
.row-fluid .offset5 {
margin-left: 44.48871181938911%;
*margin-left: 44.3823288406657%;
}
.row-fluid .offset5:first-child {
margin-left: 42.49667994687915%;
*margin-left: 42.390296968155745%;
}
.row-fluid .offset4 {
margin-left: 35.98937583001327%;
*margin-left: 35.88299285128988%;
}
.row-fluid .offset4:first-child {
margin-left: 33.99734395750332%;
*margin-left: 33.890960978779916%;
}
.row-fluid .offset3 {
margin-left: 27.49003984063745%;
*margin-left: 27.383656861914048%;
}
.row-fluid .offset3:first-child {
margin-left: 25.49800796812749%;
*margin-left: 25.391624989404086%;
}
.row-fluid .offset2 {
margin-left: 18.99070385126162%;
*margin-left: 18.88432087253822%;
}
.row-fluid .offset2:first-child {
margin-left: 16.99867197875166%;
*margin-left: 16.892289000028256%;
}
.row-fluid .offset1 {
margin-left: 10.49136786188579%;
*margin-left: 10.384984883162385%;
}
.row-fluid .offset1:first-child {
margin-left: 8.49933598937583%;
*margin-left: 8.392953010652427%;
}
input,
textarea,
.uneditable-input {
margin-left: 0;
}
.controls-row [class*="span"] + [class*="span"] {
margin-left: 30px;
}
input.span12,
textarea.span12,
.uneditable-input.span12 {
width: 1492px;
}
input.span11,
textarea.span11,
.uneditable-input.span11 {
width: 1364px;
}
input.span10,
textarea.span10,
.uneditable-input.span10 {
width: 1236px;
}
input.span9,
textarea.span9,
.uneditable-input.span9 {
width: 1108px;
}
input.span8,
textarea.span8,
.uneditable-input.span8 {
width: 980px;
}
input.span7,
textarea.span7,
.uneditable-input.span7 {
width: 852px;
}
input.span6,
textarea.span6,
.uneditable-input.span6 {
width: 724px;
}
input.span5,
textarea.span5,
.uneditable-input.span5 {
width: 596px;
}
input.span4,
textarea.span4,
.uneditable-input.span4 {
width: 468px;
}
input.span3,
textarea.span3,
.uneditable-input.span3 {
width: 340px;
}
input.span2,
textarea.span2,
.uneditable-input.span2 {
width: 212px;
}
input.span1,
textarea.span1,
.uneditable-input.span1 {
width: 84px;
}
.thumbnails {
margin-left: -30px;
}
.thumbnails > li {
margin-left: 30px;
}
.row-fluid .thumbnails {
margin-left: 0;
}
}
You can plug in your customised values here:
http://twitter.github.io/bootstrap/customize.html

Resources