Multiple SCSS equations to work out width minus margin - sass

I have a mixin that splits items of a users choosing into an inline-block grid. Users can specify how many in a row, gutter and the child element to target.
This all works fine and an example is below:
Original - SCSS
#mixin list-grid($per-row, $spacing, $selector){
margin: 0 em(-$spacing/2);
#include clearfix;
//negate the display-inline biatch
letter-spacing: -0.31em;
> #{$selector} {
width: 100% / $per-row;
font-size: 16px;
position: relative;
padding: 0 em($spacing/2) em($spacing) em($spacing/2);
display: inline-block;
vertical-align: top;
letter-spacing: 0;
background-clip: content-box;
}
}
My question is.. When i try and use margin I need to rework the calculations as previously this worked because padding is not accounted when working out widths, whereas now with margin I need to adjust the widths to account for the chosen margin.
I'm not sure how to best approach this. Any help appreciated.
New Attempt - SCSS
#mixin list-grid($per-row, $spacing, $selector){
margin: 0 em(-$spacing/2);
#include clearfix;
//negate the display-inline biatch
letter-spacing: -0.31em;
> #{$selector} {
/* not sure what to do here */
width: 100% / $per-row -$spacing;
font-size: 16px;
position: relative;
margin: 0 em($spacing/2) em($spacing) em($spacing/2);
display: inline-block;
vertical-align: top;
letter-spacing: 0;
background-clip: content-box;
}
}
The latest attempt ends up with a width of 8% if I do a row of 3, with 25 gutter. My math must be way off.
Working example

Related

Not being able to style <StripeCheckout>

This is the html:
<StripeCheckout className='payBtn' />
And this is how it looks right now:
And this is the .scss for it:
.payBtn {
display: block;
background-color: rgba(160, 255, 223, 0.596);
color: black;
font-size: 1.3rem;
line-height: 1;
font-weight: 200;
width: 100%;
margin: 0 auto;
padding: 1rem 0;
border: 0;
outline: none;
text-transform: uppercase;
cursor: pointer;
&:hover {
background-color: rgba(114, 250, 205, 0.699);
}
}
What I'm trying to make it look like:
what it needs to look like
Everything else on the page is styled according to the stylesheet. Even the size of the button of pay with card is. But the colors and stuff are not changing. Any help would be appreciated, thanks :D

How can I mimic this revolving text animation for my e-commerce store?

I'd like to use the text animation found on the Janji.com homepage (Shopify store), near the bottom above the footer.
The text says:
Equipping you for the [ journey ] ahead.
And "journey" is a list item that cycles between several other words.
I'm unable to find out how to do this online in a way similar to this. Ideally it'd be javascript or something lighter than copy-pasting a hundred lines of CSS into my store. Is there some sort of library I'm not aware of?
.prop-wrapper.vert-scroll {
color: #0064a5;
font-size: 2.5em;
font-weight: 700;
padding: 3%;
}
.tickerv-wrap {
background: 0 0;
box-sizing: content-box;
height: 55px;
overflow: hidden;
padding: 0;
margin-bottom: 12.5px;
display: inline-block;
vertical-align: middle;
}
.tickerv-wrap ul {
padding: 0;
margin: 0;
list-style-type: none;
animation-name: tickerv;
animation-duration: 10s;
animation-iteration-count: infinite;
animation-timing-function: cubic-bezier(1,0,0.5,0);
}
.tickerv-wrap ul li {
font-size: 1em;
line-height: 50px;
color: #0064a5;
font-weight: 700;
margin: 0 0;
}
#keyframes tickerv{
0%{margin-top:0}25%{margin-top:-50px}50%{margin-top:-100px}75%{margin-top:-150px}100%{margin-top:0}}.tickerv-wrap ul{padding:0;margin:0;list-style-type:none;animation-name:tickerv;animation-duration:10s;animation-iteration-count:infinite;animation-timing-function:cubic-bezier(1,0,0.5,0)}.tickerv-wrap ul:hover{animation-play-state:paused}
After checking the code on the website,
I found this done using the CSS code and you can use the bellow code and implement it on any website.
<div class="prop-wrapper vert-scroll" style="max-width: 1500px; margin:auto;">
Equipping you for the [
<div class="tickerv-wrap"><ul>
<li>path</li>
<li>trail</li>
<li>road</li>
<li>journey</li>
</ul></div>
] ahead
</div>

Remove padding on ion-slide

I want to remove the padding on item inside ion-slide. By setting the background color, I've found that it must come from there, as shown in the pic:
I want to remove the green zone.
<ion-content >
<ion-slides style="background-color: #976914d0" >
<ion-slide *ngFor="let channel of channels" style="background-color: #0c8831d0">
<div class="flex-container">
<br/>
<h1 class="title-top"> {{channel.name}} </h1>
...
and what i've tried with scss so far:
.ios, .md {
page-home {
ion-slide {
margin: 0 0 0 0 !important;
padding: 0 0 0 0 !important;
}
.flex-container {
flex-basis:100% !important;
overflow: auto;
height: 100% !important;
background-color: #3498db;
//height: 100%;
//display: flex; /* or inline-flex */
flex:1;
//align-content: space-between;
justify-content: space-around;
flex-direction: column;
//flex-grow: 1;
border: solid 5px #000000 ;
}
[EDIT] I should have mentioned that in flex-container I can set height: 600px; and it makes larger item, but it is not portable. and height: 100% does nothing.
In flexbox the value should be flex-start for the align-self property.
Given your current configuration, start with this:
.flex-container {
align-self: flex-start;
}
I found some work around but it is not perfect. It remove the space on top, but I'm still unable to set container size auto adjustable to windows... I overwrite some config on ion-slide. I saw another class that is nested in ion-slide; swiper-slide. I have not tried all of it config...
ion-slides {
height: auto !important;
}
.flex-container {
//height: 100% !important;
display: flex;
flex-direction: column;
height: 500px;
justify-content: space-between;
border: solid 5px #000000 ;
}
[EDIT]finally got the right answer, add:
.scroll-content {
display: flex;
flex-direction: column;
ion-slides {
display: flex;
}
}
.slide-zoom {
height: 100%
}
worked for me. Have a look at the Ionic Demo Source:
https://github.com/ionic-team/ionic-preview-app/tree/master/src/pages/slides/basic

Weird SASS compiling behavior

I moved my dev environment over to a different VPS and am having a weird timing issue when I save a SCSS file I'm working on. Attached below is a screen shot to give you an understanding of what I'm trying to explain.
Each block of output is another save, with nothing being changed at all in the SCSS file. You'll see that it often doesn't end on "overwrite style.css" and sometimes errors when I know there isn't actually an error. This means I have to keep hitting save in HOPES that it lands correctly on overwrite, or else it outputs a blank .css file. Waste of time, and frustrating..
It also seems to be doubling up sometimes on a single save..
Any ideas?
http://goo.gl/nQK0Q
Snippet below starts at line 972:
li {
-webkit-transition: all .35s ease-in-out;
-moz-transition: all .35s ease-in-out;
transition: all .35s ease-in-out;
padding: 1em 0;
border: 1px solid #eff1f2;
border-top: 1px solid $hr;
&:hover {
background: #e7ebec;
border: 1px solid $hr;}
.img-wrap {
width: 12.188em;
text-align: center;
margin-right:1em;
padding: 1em 0;}
}
.text-box {
width: 26.688em;
padding: 1.1em 0 0 0;
h3 {
font-size: 1.5em;
text-transform: capitalize;}
p {
font-size: 0.75em;
color: #aabcc8;
font-weight: 600;
text-transform: uppercase;
padding: 0 0 .25em 0;
a {
text-decoration: none;
color: $blue;}
}
}

CSS3 Pie not working with SASS/Compass

I'm having trouble getting CSS3Pie to work. I've read several posts on SO and Google and still can't to seem to get it work.
I'm using SASS and compass to write my CSS so I'll post both SCSS and CSS outputs below.
SCSS:
$pie-behavior: url(PIE.htc);
$pie-base-class: pie-element;
#header{
background:#fff;
width:$full-width;
height:100px;
margin:$margin-center;
ul{
width:600px;
height:$nav-height - 2px;
padding:55px 0 0;
margin:0 0 0 250px;
li{
#include inline-block;
font-size:$font-size - 2px;
font-weight:bold;
padding:20px 10px;
}
a{
color:#282828;
text-transform:uppercase;
&:hover{
color:red;
}
}
}
#aabw{
background:url('../images/aabw.jpg') no-repeat;
height:190px;
width:110px;
position:relative;
z-index: 0;
float:right;
margin: 0 270px 0 0;
#include pie-element(relative);
#include box-shadow(#BBBBBB 0px -78px 6px);
}
}
Outputted CSS:
#header #aabw {
background: url("../images/aabw.jpg") no-repeat;
height: 190px;
width: 110px;
position: relative;
z-index: 0;
float: right;
margin: 0 270px 0 0;
behavior: url(PIE.htc);
position: relative;
-webkit-box-shadow: #bbbbbb 0px -78px 6px;
-moz-box-shadow: #bbbbbb 0px -78px 6px;
box-shadow: #bbbbbb 0px -78px 6px;
}
My PIE.htc is in the room directory (same folder as my index) and I'm trying to run it locally. I've followed the pie.scss file and nothing seems to work, it may be a case of me missing something blatantly obvious so hopefully someone might be able to spot something I'm missing?
Thanks
not sure, but try putting the PIE call after the box-shadow call.

Resources