HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
!!! 5
%html
%head
%title Responsive Dozenal Sass Grid
%body
%header.header.p-lg-vm
%hgroup.container
%h1 Responsive Dozenal Sass Grid
/
.header.m-xs-tl.p-lg-vm
.container
%h2 Table of Contents
.container
%ul.collapsed.m-xs-tl
%li
%a{:href=>"#codepen"} The Codepen Code
%li
%a{:href=>"#container"} The Container
%li
%a{:href=>"#breakpoints"} The Breakpoints
%li
%a{:href=>"#dozenal"} The Dozenal Grid
%li
%a{:href=>"#square"} The Responsive Square
%li
%a{:href=>"#mainside"} Main / Side Columns
%li
%a{:href=>"#utilities"} Utility Classes
%li
%a{:href=>"#closing"} Closing Thoughts
%div.main-body
.header.m-xs-tl.p-lg-vm.active#idcodepen{:'data-id'=>"idcodepen"}
.container
%h2 The Codepen Code
.container
%p Make sure you check the haml and sass from the codepen and then click the "View Compiled" buttons to see the html and css outputs from these two languages.
%p There is a lot to cover here, so go piece by piece, and ask any questions in the codepen comments.
.header.m-xs-tl.p-lg-vm#idcontainer{:'data-id'=>"idcontainer"}
.container
%h2 The Container
.container
%p The container is your first line of defense in a modern website for basic responsiveness. The container class is used to define a maximum width for your main site size. It should be put on a parent element around any section that should not go bigger than your chosen width.
%p Notice that the headings are all full width color, but then have a container inside of them. While the rest of the site is all within their own containers.
.header.m-xs-tl.p-lg-vm#idbreakpoints{:'data-id'=>"idbreakpoints"}
.container
%h2 The Breakpoints
.container
%p Throughout this library almost every class has a responsive prefix inside of it. There are five prefixes that each equal a css Media Query breakpoint.
%table.table
%thead
%tr
%th prefix
%th name
%th min-width
%tbody
%tr
%td xs
%td extra-small
%td 0
%tr
%td sm
%td small
%td 320px
%tr
%td md
%td medium
%td 600px
%tr
%td lg
%td large
%td 960px
%tr
%td xl
%td extra-large
%td 1200px
%p Because minimum widths are used in this library, it means that all design patterns and decisions should be made as mobile first. Breakpoint values will retain from the smallest size they are set through any higher sizes that don't override those values. What does this mean?
%p You don't need to set class="col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xl-12". You only need to set one value, at the smallest breakpoint, and it will carry over to the higher breakpoints. so class="col-xs-12" is sufficient to cover all breakpoints, whereas class="col-md-12" will have no value at xs and sm, but md lg and xl will all be covered. Likewise, you can skip breakpoints in the middle of relevant change breakpoints, so class="col-xs-12 col-lg-6" will have 12 for xs sm and md, and will have 6 for lg and xl.
%p Only set breakpoint classes where the column value would change.
.header.m-xs-tl.p-lg-vm#iddozenal{:'data-id'=>"iddozenal"}
.container
%h2 The Dozenal Grid
.container
%p This is a 12 column grid library that showcases haml, and sass code as well as many examples for how to understand and use a dozenal grid.
%p Dozenal comes from dozen, meaning 12. It means a base 12 number system. Like Decimal, which means base 10.
%p Here is a grid with only two columns. They are not responsive, and instead will always be two 50% columns at every browser size. The first time a designer meets a grid library it can be difficult to understand how to interperet the classes. XS in this case indicates "starting from the Extra Small Media Query" and 6 indicates "Covers 6 of the twelve columns available". So this would mean starting at xs size, this covers 50% of a 12 column grid.
%p Try changing the size of your browser to see the difference in any of these examples (or rotate your device). And if you're on mobile, there should be little 1x 0.5x 0.25x buttons to allow you to see different sizes. This first example will have no difference. most of the others will.
.grid.lined
.row.gap
.col-xs-6
.well First
.col-xs-6
.well Second
%p This next grid has 12 segments that have many Media Query breakpoints that allow very dynamic layout changes for different sizes of browser. Notice that they are written in order of the Media Query breakpoints so that they can be easily understood by a human, but the order of assignment is irrelevant.
%p Notice that each Media Query breakpoint is covered in this example, but this is totally unnecessary. This grid is mobile first, which means that if as long as you use a XS breakpoint, until another breakpoint issues a different value, all breakpoints will share the first's value. You can even see that the breakpoints don't follow a completely linear change in columns covered, since LG in this example covers a 4 columns (a third) and MD covers 3 columns (a fourth)
%p Notice also that if you intend to have many different elements sometimes on one line, sometimes on many lines, you don't need to, and probably shouldn't, put a row around each possible visible row. Elements will naturally flow to new visible rows when the space limitations demand it.
.grid.lined
.row.gap
- (1..12).each do |i|
.col-xs-12.col-sm-6.col-md-3.col-lg-4.col-xl-1
.well #{i}
%p Here is a grid without gap. It is important to understand that a grid should always be used for structure and rarely altered for design. We use a simple well class to give a bit of differentiation between our columns. But these wells are placed inside of the columns, not attached to them.
.grid.lined
.row
- (1..6).each do |i|
.col-xs-12.col-md-6.col-lg-2
.well #{i}
%p Here are some more examples. Just check the code. The column count for each breakpoint should always add up to 12.
.grid.lined
.row.gap
.col-xs-12.col-sm-4.col-md-3.col-lg-5.col-xl-2
.well 1
.col-xs-12.col-sm-4.col-md-6.col-lg-2.col-xl-4
.well 2
.col-xs-12.col-sm-4.col-md-3.col-lg-5.col-xl-6
.well 3
%p Offsets are available in this library. Offsets allow you to push an element over on the left based on column sizes. Just remember to always have your numbers add up to 12, including both columns and offsets.
.grid.m-xs-tm.lined
.row.gap
.col-xs-8.offset-xs-4.col-md-5.offset-md-0.col-lg-2
.well 1
.col-xs-12.col-md-5.offset-md-2.col-lg-2.offset-lg-3
.well 2
.col-xs-12.col-lg-2.offset-lg-3
.well 3
%p Grids have a percentage of a parent's width, even if the parent is another column. That means when you're designing, it is often useful to break up a design into smaller sub grids.
.grid.m-xs-tm.lined
.row
.col-xs-12.col-md-6
.well
%div
.well 1
.grid.lined
.row.gap
.col-xs-12.col-md-6
.well 1
.col-xs-12.col-md-6
.well 2
.col-xs-12.col-md-6
.well
%div
.well 2
.grid.lined
.row.gap
.col-xs-12.col-md-4
.well 1
.col-xs-12.col-md-4
.well 2
.col-xs-12.col-md-4
.well 3
.header.m-xs-tl.p-lg-vm#idsquare{:'data-id'=>"idsquare"}
.container
%h2 The Responsive Square
.container
%p This example shows a couple tricky tricks to do a couple tricky things.
%ol
%li The first element inside the responsive column (.square-parent) is set to a responsive square.
%li The next element (.square-child) uses a simple css class to make a child fill it's parent and immediately give height to the weird non-height trick we just pulled. It also sets this element to position absolute, and a well for visual.
%li The final element (.centered-child) uses a css trick to make a child centered horizontally and vertically in a parent, as long as that parent has height. Notice the lorem text does not have specified height or width. Change the text, add breaks, it will still be centered.
.grid.m-xs-tm.lined
.row.gap
- (1..6).each do |i|
.col-xs-12.col-sm-6.col-md-4.col-xl-2
.square-parent
.square-child.well
.centered-child lorem
.header.m-xs-tl.p-lg-vm#idmainside{:'data-id'=>"idmainside"}
.container
%h2 Main / Side columns
.container
%p Here we have a series of main section / side section grids just for fun, but also for common website layout. The side columns have a fixed width of 200 pixels, while the main columns relatively take up the rest of the space available.
.grid.lined
.row.gap.gap-small
.col-xs-12.col-md-side
.well
%ul.collapsed
%li Side Section
%li Link 1
%li Link 2
%li Link 3
.col-xs-12.col-md-main
.well
%p.m-xs-n This is a main section with one side section on the left.
%p Maybe this one will give you a better idea how this all might actually work. Also there are two side columns in this one. Columns with different heights definitely work better when there is one background color (or none) instead of individual background colors.
.grid.m-xs-tm.well.lined
.row.gap
.col-xs-12.col-md-side
%ul.collapsed
%li Side Section
%li Link 1
%li Link 2
%li Link 3
.col-xs-12.col-md-main
%p.m-xs-n This is a main section with two side sections. Notice that the class has changed to .col-md-main2, instead of just .col-md-main.
%p Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris consectetur sodales mollis. Vestibulum tincidunt, urna non blandit suscipit, lacus nunc laoreet massa, quis elementum ex ex sit amet lacus. Donec dui lorem, tempor id dictum a, mattis nec ipsum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In nec vestibulum felis, non aliquam leo. In eget nisi rhoncus, auctor elit in, interdum purus. Donec eros magna, pellentesque ut lorem sit amet, laoreet rutrum leo. Nullam ultrices dapibus felis.
%p Sed efficitur, dolor sit amet porttitor varius, mi quam vehicula nisi, eget accumsan libero lacus eu augue. Donec faucibus quis turpis ac pellentesque. Suspendisse dignissim porta arcu, ac consectetur nisl hendrerit et. In in dolor sollicitudin, posuere arcu sed, gravida dui. Aenean posuere odio sit amet magna semper sodales. Nam eu nunc porttitor, congue felis ac, porta orci. Pellentesque nisi nisi, egestas at ullamcorper bibendum, feugiat vitae nibh. Vestibulum convallis commodo orci quis euismod. Donec nisl nisi, ullamcorper vitae porttitor eget, volutpat eget ante.
.col-xs-12.col-md-side
%ul.collapsed
%li Side Section
%li Link 1
%li Link 2
%li Link 3
%p The outer grid here has gap, but the inner does not.
.grid.m-xs-tm.lined
.row.gap
.col-xs-12.col-md-main
.well
%p.m-xs-n
This is a main section with one side section on the right. Grids can go inside of other grids, and each sub grid receives a percentage of the parent element.
.grid.m-xs-tm.lined
.row
.col-xs-12.col-sm-6
.well content
.col-xs-12.col-sm-6
.well content
.col-xs-12.col-md-side
.well
%ul.collapsed
%li Side Section
%li Link 1
%li Link 2
%li Link 3
.header.m-xs-tl.p-lg-vm#idutilities{:'data-id'=>"idutilities"}
.container
%h2 Utility Classes
.container
%p Get ready for examples galore of all the utility classes that this library has available. Also notice that you can easily add your own. These classes are great for starting a project, but should definitely be streamlined into custom classes later. All of these classes are potentially responsive.
%p The key to understanding the utility classes is seeing the patterns, and then understanding that they all work the exact same way.
%h3 Box Model
%p Both padding and margin use the same values. A direction, followed by a size.
%h4 Direction
%ul
%li t: top
%li r: right
%li b: bottom
%li l: left
%li v: vertical
%li h: horizontal
%h4 Size
%ul
%li l: 20px
%li m: 10px
%li s: 5px
%li n: 0 (this one is mostly for responsive removal)
%h4 Padding (with large distance)
.lined.display-ib
.swell.p-xs-tl .p-xs-tl
.lined.display-ib
.swell.p-xs-rl .p-xs-rl
.lined.display-ib
.swell.p-xs-bl .p-xs-bl
.lined.display-ib
.swell.p-xs-ll .p-xs-ll
.lined.display-ib
.swell.p-xs-vl .p-xs-vl
.lined.display-ib
.swell.p-xs-hl .p-xs-hl
.lined.display-ib
.swell.p-xs-l .p-xs-l
.lined.display-ib
.swell.p-xs-n .p-xs-n
%h4 Margin (with medium distance)
.lined.display-ib
.swell.m-xs-tm .m-xs-tm
.lined.display-ib
.swell.m-xs-rm .m-xs-rm
.lined.display-ib
.swell.m-xs-bm .m-xs-bm
.lined.display-ib
.swell.m-xs-lm .m-xs-lm
.lined.display-ib
.swell.m-xs-vm .m-xs-vm
.lined.display-ib
.swell.m-xs-hm .m-xs-hm
.lined.display-ib
.swell.m-xs-m .m-xs-m
.lined.display-ib
.swell.m-xs-n .m-xs-n
%h3 Alignment
%p I decided to use the same class prefix for vertical and horizontal alignment.
%h4 Horizontal
%ul
%li l: Left
%li c: Center
%li r: Right
%li j: Justify
.grid
.row.gap
.col-xs-12.col-md-3
%strong .align-xs-l
.align-xs-l Sed efficitur, dolor sit amet porttitor varius, mi quam vehicula nisi, eget accumsan libero lacus eu augue. Donec faucibus quis turpis ac pellentesque. Suspendisse dignissim porta arcu, ac consectetur nisl hendrerit et. In in dolor sollicitudin, posuere arcu sed, gravida dui. Aenean posuere odio sit amet magna semper sodales. Nam eu nunc porttitor, congue felis ac, porta orci.
.col-xs-12.col-md-3
%strong .align-xs-r
.align-xs-r Sed efficitur, dolor sit amet porttitor varius, mi quam vehicula nisi, eget accumsan libero lacus eu augue. Donec faucibus quis turpis ac pellentesque. Suspendisse dignissim porta arcu, ac consectetur nisl hendrerit et. In in dolor sollicitudin, posuere arcu sed, gravida dui. Aenean posuere odio sit amet magna semper sodales. Nam eu nunc porttitor, congue felis ac, porta orci.
.col-xs-12.col-md-3
%strong .align-xs-c
.align-xs-c Sed efficitur, dolor sit amet porttitor varius, mi quam vehicula nisi, eget accumsan libero lacus eu augue. Donec faucibus quis turpis ac pellentesque. Suspendisse dignissim porta arcu, ac consectetur nisl hendrerit et. In in dolor sollicitudin, posuere arcu sed, gravida dui. Aenean posuere odio sit amet magna semper sodales. Nam eu nunc porttitor, congue felis ac, porta orci.
.col-xs-12.col-md-3
%strong .align-xs-j
.align-xs-j Sed efficitur, dolor sit amet porttitor varius, mi quam vehicula nisi, eget accumsan libero lacus eu augue. Donec faucibus quis turpis ac pellentesque. Suspendisse dignissim porta arcu, ac consectetur nisl hendrerit et. In in dolor sollicitudin, posuere arcu sed, gravida dui. Aenean posuere odio sit amet magna semper sodales. Nam eu nunc porttitor, congue felis ac, porta orci.
%h4 Vertical
%ul
%li t: Top
%li m: Middle
%li b: Bottom
%li bl: Baseline
%li tb: text-bottom
.grid
.row.gap
.col-xs-12.col-md-2
%strong .align-xs-t
.m-xs-tm
.display-xs-ib.lined.align-xs-t &
.display-xs-ib.well.align-xs-t &<br>&
.col-xs-12.col-md-2
%strong .align-xs-m
.m-xs-tm
.display-xs-ib.lined.align-xs-m &
.display-xs-ib.well.align-xs-m &<br>&
.col-xs-12.col-md-2
%strong .align-xs-b
.m-xs-tm
.display-xs-ib.lined.align-xs-b &
.display-xs-ib.well.align-xs-b &<br>&
.col-xs-12.col-md-2
%strong .align-xs-bl
.m-xs-tm
.display-xs-ib.lined.align-xs-bl &
.display-xs-ib.well.align-xs-bl &<br>&
.col-xs-12.col-md-2
%strong .align-xs-tb
.m-xs-tm
.display-xs-ib.lined.align-xs-bl &
.display-xs-ib.well.align-xs-bl &<br>&
%h4 Pull Floats
%ul
%li left
%li right
%li none
%li clear (clears both)
%li center (this just makes left and right margins auto, and will only work on a block element that has a defined width)
.grid
.row.gap
.col-xs-12.col-md-3
.align-xs-j
%strong.pull-xs-left.well .pull-xs-left
Sed efficitur, dolor sit amet porttitor varius, mi quam vehicula nisi, eget accumsan libero lacus eu augue. Donec faucibus quis turpis ac pellentesque. Suspendisse dignissim porta arcu, ac consectetur nisl hendrerit et. In in dolor sollicitudin, posuere arcu sed, gravida dui. Aenean posuere odio sit amet magna semper sodales. Nam eu nunc porttitor, congue felis ac, porta orci.
.col-xs-12.col-md-3
.align-xs-j
%strong.pull-xs-right.well .pull-xs-right
Sed efficitur, dolor sit amet porttitor varius, mi quam vehicula nisi, eget accumsan libero lacus eu augue. Donec faucibus quis turpis ac pellentesque. Suspendisse dignissim porta arcu, ac consectetur nisl hendrerit et. In in dolor sollicitudin, posuere arcu sed, gravida dui. Aenean posuere odio sit amet magna semper sodales. Nam eu nunc porttitor, congue felis ac, porta orci.
.col-xs-12.col-md-3
.align-xs-j
%strong.pull-xs-none.well .pull-xs-none
Sed efficitur, dolor sit amet porttitor varius, mi quam vehicula nisi, eget accumsan libero lacus eu augue. Donec faucibus quis turpis ac pellentesque. Suspendisse dignissim porta arcu, ac consectetur nisl hendrerit et. In in dolor sollicitudin, posuere arcu sed, gravida dui. Aenean posuere odio sit amet magna semper sodales. Nam eu nunc porttitor, congue felis ac, porta orci.
.col-xs-12.col-md-3
.align-xs-j
%strong.pull-xs-left.well .pull-xs-left
%strong.pull-xs-left.pull-xs-clear.well .pull-xs-clear
Sed efficitur, dolor sit amet porttitor varius, mi quam vehicula nisi, eget accumsan libero lacus eu augue. Donec faucibus quis turpis ac pellentesque. Suspendisse dignissim porta arcu, ac consectetur nisl hendrerit et. In in dolor sollicitudin, posuere arcu sed, gravida dui. Aenean posuere odio sit amet magna semper sodales. Nam eu nunc porttitor, congue felis ac, porta orci.
%h4 Display
%p eg. .display-xs-ib
%ul
%li b: block
%li ib: inline-block
%li n: none
%li f: flex
%li if: inline-flex
%h4 Position
%p eg. .position-xs-a
%ul
%li s: static
%li r: relative
%li a: absolute
%li f: fixed
.header.active.m-xs-tl.p-lg-vm#idflexgroup{:'data-id'=>"idflexgroup"}
.container
%h2 Flex Group
.container
%ul
%li .flex-parent
%li .flex-wrap
%li .flex-nowrap
%li .flex-child
%li .flex-none
%li .flex-vertical
%li .flex-horizontal
%li .flex-align-center
%li .flex-justify-center
%ul
%li .order-xs-1
%div.flex-parent
%div.flex-none
%div.well stuff
%div.flex-child
%div.nowell spacer
%div.flex-none
%div.well stuff
%div.display-xs-block.flex-md-parent
%div.flex-child
%div.well stuff
%div.flex-child
%div.well stuff
.header.m-xs-tl.p-lg-vm#idclosing{:'data-id'=>"idclosing"}
.container
%h2 Closing Thoughts
.container
%ul
%li A grid library should be used for layout. Design and content should always be placed inside columns, columns in rows, and (in this case) rows in grids.
%li A row with only one element in it that is only col-xs-12 is not a row or a column. That's just a div. Don't use rows and grids where they are not needed.
%li For the most part, grids can get gross and confusing. Feel free to simplify things in your html and css later, after you've gotten your design into a place that feels good. Grids are great for starting a project, but they can be intimidating to alter in the future.
%li Learning how to use a css library is a great idea. Learning why things are done in css is a better idea. You know... actually learning css. It's hard. It's weird. But it's worth it.
$column-length: 12;
$column-gap: 12px;
$gutter-size:1.1;
$side-column-width:180px;
$container-map: (
xs:0,
sm:320px,
md:600px,
lg:960px,
xl:1200px
);
$sizes-map: (
l:20px,
m:10px,
s:5px,
n:0
);
$positions-map:(
t:top,
r:right,
b:bottom,
l:left
);
$boxes-map: (
p:padding,
m:margin
);
$alignment-ver-map: (
t:top,
m:middle,
b:bottom,
bl:baseline,
tb:text-bottom
);
$alignment-hor-map: (
l:left,
c:center,
r:right,
j:justify
);
$display-map: (
b:block,
ib:inline-block,
n:none,
f:flex,
if:inline-flex
);
$positioning-map: (
s:static,
r:relative,
a:absolute,
f:fixed
);
@mixin clearfix {
content:"";
display:table;
clear:both;
}
* {
box-sizing:border-box;
transition:width 0.3s, height 0.3s;
}
/* Just design stuff, not grid */
// These couple things aren't super important to your grid system, but they help me with the examples, and make my page look pretty.
// Oh god, I keep adding more!
body {
margin:0;
font-family:calibri,sans-serif;
}
$main-color:#76B3A2;
.header {
background-color:$main-color;
&+.container {
// max-height:300vh;
// transition:max-height 0.15s;
overflow:auto;
}
h1,
h2{
margin:0;
color:white;
}
&:not(.active)+.container {
padding:0;
max-height:0;
}
}
div.header {
cursor:pointer;
position:relative;
&:hover {
background-color:lighten($main-color,10%);
}
&::after {
content:'>';
position:absolute;
right:1em;
top:50%;
color:white;
transform:translateY(-50%);
transition:transform 0.3s;
}
&.active::after {
transform: translateY(-50%)rotate(90deg);
}
}
h1,
h2 {
font-family:cambria,serif;
}
a {
color:$main-color;
font-weight:bold;
text-decoration:none;
&:hover {
text-decoration:underline;
}
}
.collapsed {
list-style-type:none;
margin-top:0;
margin-bottom:0;
padding-left:0;
}
.well {
background-color:rgba(0,0,0,0.12);
padding: $column-gap;
border-radius: 0;
border:1px solid rgba(0,0,0,0.12);
height:100%;
}
.swell {
@extend .well;
padding:initial;
}
.nowell {
@extend .well;
background-color:transparent;
}
.lined {
border:1px solid rgba(0,0,0,0.5);
}
.centered-child {
position:absolute;
top:50%;
left:50%;
transform:translate(-50%,-50%);
}
.fill-child {
height:100%;
width:100%;
}
.square {
&-parent {
position:relative;
height:0;
padding-bottom:100%;
}
&-child {
@extend .fill-child;
position:absolute;
}
}
.table {
width:100%;
border-collapse:collapse;
td,
th{
padding:$column-gap/2;
text-align:left;
}
tr {
border-bottom:1px solid rgba(0,0,0,0.12);
}
}
/* end design stuff */
@mixin make-box-utilities($pre:''){
@each $box-short,$box-long in $boxes-map {
@each $suf-short,$suf-long in $sizes-map {
@each $pos-short,$pos-long in $positions-map {
.#{$box-short}#{$pre}-#{$pos-short}#{$suf-short} {
#{$box-long}-#{$pos-long}: $suf-long;
}
}
.#{$box-short}#{$pre}-h#{$suf-short} {
#{$box-long}-left: $suf-long;
#{$box-long}-right: $suf-long;
}
.#{$box-short}#{$pre}-v#{$suf-short} {
#{$box-long}-top: $suf-long;
#{$box-long}-bottom: $suf-long;
}
.#{$box-short}#{$pre}-#{$suf-short} {
#{$box-long}: $suf-long;
}
}
}
}
@mixin make-main-utilities($pre:'') {
.pull#{$pre}-left { float:left; }
.pull#{$pre}-right { float:right; }
.pull#{$pre}-none { float:none; }
.pull#{$pre}-clear { clear:both; }
.pull#{$pre}-center {
margin-left:auto;
margin-right:auto;
}
// Make horizontal alignments
@each $short,$long in $alignment-hor-map {
.align#{$pre}-#{$short} { text-align:$long; }
}
// Make vertical alignments
@each $short,$long in $alignment-ver-map {
.align#{$pre}-#{$short} { vertical-align:$long; }
}
// Make display varieties
@each $short,$long in $display-map {
.display#{$pre}-#{$short} { display:$long; }
}
// Make positioning varieties
@each $short,$long in $positioning-map {
.position#{$pre}-#{$short} { position:$long; }
}
}
@mixin make-container($pre:''){
.container {
@if($pre=='') {
margin-right:auto;
margin-left:auto;
max-width:map-get($container-map,'lg');
padding:$column-gap;
}
@if($pre=='-lg') {
padding:0;
}
@if($pre=='-xl') {
max-width:map-get($container-map,'xl');
}
}
}
@mixin make-grid{
.grid {
overflow:hidden;
}
.row {
display:flex;
flex-wrap:wrap;
&.gap {
--column-gap:#{$column-gap};
margin-top: calc(-1 * var(--column-gap));
margin-left: calc(-0.5 * var(--column-gap));
margin-right: calc(-0.5 * var(--column-gap));
&>[class*='col-'] {
padding-top: calc(1 * var(--column-gap));
padding-left: calc(0.5 * var(--column-gap));
padding-right: calc(0.5 * var(--column-gap));
}
&-large { --column-gap:#{$column-gap*2}; }
&-small { --column-gap:#{$column-gap*0.5}; }
}
}
}
@mixin make-columns($pre:''){
.col#{$pre}-side { flex: 0 1 $side-column-width; }
.col#{$pre}-main { flex: 1 1 1px; }
@for $i from 0 through $column-length {
@if($i>0) {
.col#{$pre}-#{$i} { flex: 0 0 calc(100% * (#{$i} / #{$column-length})); }
}
@if($i<$column-length) {
.offset#{$pre}-#{$i} { margin-left: calc(100% * (#{$i} / #{$column-length})); }
}
}
}
@mixin make-flexgroup($pre:'') {
.flex#{$pre}-parent { display:flex; }
.flex#{$pre}-wrap { flex-wrap:wrap; }
.flex#{$pre}-nowrap { flex-wrap:nowrap; }
.flex#{$pre}-child { flex:1 1 auto; }
.flex#{$pre}-none { flex:none; }
.flex#{$pre}-vertical { flex-direction:column; }
.flex#{$pre}-horizontal { flex-direction:row; }
.flex#{$pre}-align-center { align-items:center; }
.flex#{$pre}-justify-center { justify-content:center; }
@for $i from 1 through 10 {
.order#{$pre}-#{$i} { order:$i; }
}
}
@include make-grid;
@include make-container;
@include make-columns;
@include make-box-utilities;
@include make-main-utilities;
@include make-flexgroup;
@each $pre-short,$pre-long in $container-map {
/*---------------------------------------------------------------
#{$pre-short} media minimum
-----------------------------------------------------------------*/
@media (min-width:$pre-long) {
@include make-container(-#{$pre-short});
@include make-columns(-#{$pre-short});
@include make-box-utilities(-#{$pre-short});
@include make-main-utilities(-#{$pre-short});
@include make-flexgroup(-#{$pre-short});
}
}
$("div.header").on("click",function(){
if($(this).hasClass("active")) {
$(this).removeClass("active");
return;
} else {
$(this).addClass("active")
.siblings("div.header").removeClass("active");
}
$(".main-body")[0].scrollTop = this.offsetTop;
});
Also see: Tab Triggers