How to set the width AND max-width of a susy container - sass

I would like to achieve this mixin natively with Susy:
#mixin mainContainer($width, $maxWidth) {
width: $width;
max-width: $maxWidth;
margin-right: auto;
margin-left: auto;
}
How can I do that?
Thanks!

The only reason to use Susy for this mixin is if you want Susy to provide one of those two values. If you plan to pass in both the width and max-width explicitly as arguments, there's no need to involve Susy at all.
I'll assume you do want Susy to provide one of the values, so I'll just guess which one, and let you change it if I guess wrong. In order to use Susy with customized output, you'll use the container() function instead of the container() mixin:
#mixin mainContainer($max-width, $susy: $susy) {
width: container($susy);
max-width: $max-width;
margin-right: auto;
margin-left: auto;
}

Related

Access Angular-Material SCSS Variables (Angular4)

How to access certain SCSS variables in Angular-Material (Angular4)?
For example, the default toolbar has a CSS class as follow:
.mat-toolbar {
display: flex;
box-sizing: border-box;
width: 100%;
padding: 0 16px;
flex-direction: column;
}
I want to get the padding value, i.e. 16px, store it as $fatty-padding and then use it in my custom class, for example:
.custom-toolbar {
padding: $fatty-padding $fatty-padding;
margin: 0 $fatty-padding;
}
Is it possible?
Angular Material styles are written without variables:
So there is no easy way to get this styles and store to the variable in SCSS.

Overlap div past container with clearfix mixen overflow:hidden

I've recently updated to SingularityGS 1.4.0 and have run into an issue with my .container class using an #include clearfix; which now includes an overflow:hidden property.
For a slideshow component, I use negative/positive margins to display arrows overlapping arrows outside of the .container:
.container { //Container for the grid system
background: $background-color;
max-width: $site-width;
margin: 0 auto;
position: relative;
#include clearfix;
#include breakpoint($large-break) {
border-left: 20px solid #fff;
border-right: 20px solid #fff;
width: $site-width;
}
.container {
border: 0px;
margin: 0px;
clear: both;
}
}
.left-arrow, .right-arrow {
position: absolute;
cursor: pointer;
margin-top: -20px;
font-size: 0.8em;
width: 41px;
height: 41px;
top: 50%;
}
.left-arrow {
left: -10px;
background: url(/images/icons.png) no-repeat -153px -146px;
}
.right-arrow {
right: -10px;
background: url(/images/icons.png) no-repeat -197px -146px;
}
Here's a screenshot of the problem:
https://www.dropbox.com/s/yl4ch4yowe61kz7/Screenshot%202014-09-03%2010.06.50.png?dl=0
Should I be using something other then the clearfix mixin in my container?
Edit: - Added Sassmeister issue as requested
This version of Singularity uses the Compass clearfix. You can write your own to work as you want it:
#mixin clearfix {
&:after {
content: '';
display: table;
}
}
see: http://sassmeister.com/gist/099ef72b56365fe8ce07
Singularity doesn't have its own clearfix mixin.
You're using the clearfix mixin from Compass which leverages the overflow: hidden technhique which in turn crops your container.
The solution is to use another mixin for clearfixing.
Compass bundles three different clearfix mixins, the most usable of which is the pie-clearfix. It's output is as follows:
.foo {
*zoom: 1;
}
.foo:after {
content: "";
display: table;
clear: both;
}
I recommend that you use the clearfix mixin bundled with the beautiful toolkit Sass extension by Team Sass.
It has the following benefits over the pie-clearfix:
Shorter output that works for all modern browsers:
.foo:after {
content: "";
display: table;
clear: both;
}
Two ways of applying: the traditional mixin way (default) and the extend way. The extend way makes your CSS footprint even smaller by deduplication. The downside of the extend way is not being able to apply it from media queries, though i've never faced a situation where you would need a clearfix only in a media query and need it not to be applied outside media query.
To configure Toolkit for using the extend way apply this in the beginning of your CSS:
#include toolkit-set('clearfix extend', false);
To override current setting once use this:
#include clearfix(true);
true means the extend methhod, false means the mixin method.
Note that if you're including both Compass and Toolkit, Toolkit should come after Compass to override the clearfix mixin.
If you feel that Toolkit is too bulky for your project, simply define your own clearfix mixin after importing Compass, just like Scott suggests. Just be sure to use proper clearfix method, Scott's code (as of 2014-09-04 12:00 UTC) doesn't actually clearfix.

How to uninclude sass mixin

I've this mixin applied on a menu, I don't want see on small resolution:
#mixin visuallyhidden {
position: absolute;
overflow: hidden;
clip: rect(0 0 0 0);
height: 1px; width: 1px;
margin: -1px; padding: 0; border: 0;
}
This working fine. But on bigger resolution I will show this menu. Obviously I can restyle and revert these attributes (I'm allready done it). But I was thinking if is there some built-in way to remove mixins – something like #uninclude visuallyhidden;.
Or is there a better way how to do this?
Thanks for all suggestions.
Use media queries to only apply the styles when appropriate. Doing and undoing bloats your CSS unnecessarily.
#media (max-width: 45em) {
.foo {
#include visuallyhidden();
}
}

Singularity grid system gutters

I'm trying to have gutters not only between columns but also left and right of the layout.
Is there a way to do that using the add-gutter function?
Unlike Susy, Singularity does not provide scaffolding for containers.
To my personal taste, this is a great advantage: Singularity does not require any scaffolding either! The result is cleaner, more understandable HTML and CSS.
This does not mean that Singularity is limited in functionality. When you do need some scaffolding, you are free to build some.
Singularity provides all the necessary instruments: https://github.com/Team-Sass/Singularity/wiki/Grid-Helpers
For your purpose, there's the gutter-span() function that returns the width of the guttter relative to the container's width.
SASS:
$grids: 4
$gutters: 0.2
.element
+float-span(1)
.container
$grid-padding: gutter-span() / 2 //Adjust as necessary
padding-left: $grid-padding
padding-right: $grid-padding
Resulting CSS:
.element {
width: 21.73913%;
clear: right;
float: left;
margin-left: 0%;
margin-right: 4.34783%;
}
.container {
padding-left: 2.17391%;
padding-right: 2.17391%;
}

Responsive Images in a Responsive Container?

How do I get this Responsive Image, or what is supposed to be, to fit into the parent it is nested in?
I have applied the proper CSS, I have not defined any width or height in the HTML. Here is my CSS.
.header {
height: 25%;
width: 95%;
padding: 2.5%;
background: #fff;
}
.header img {
max-width: 100%;
height: auto;
}
You can view the issue here:
http://www.client.noxinnovations.com/jensenblair/
The big circle image? That's supposed to be Responsive.
Thanks!
I may be missing something here, but setting:
height:100%;
For the image works for me...
You need only to change max-width to width, like this:
.header img {
width: 100%;
height: auto;
}
I know this is an old question, but if you aplly
display:flex;
to the parent all of the block-type elements they will have a max-width of the parent element.

Resources