Hold on there buddy. What if the default font-size or container font-size is 12px or whatever, you may have to change it later etc. Maybe change the body font size to a variable. So $bodyfontsize. Then in your sums, 30em/$bodyfontsize;
I came across a similar problem before and instead have a mixin for creating REM's instead.
Basically if you set the html to have a default of 10px for the fontsize it makes it super easy to use. Example;
@andy_unleash - I used to do the box-shadow like that, but it doesn't work if you want to use multiple values for more than one drop shadow, or perhaps a drop and an inset. Now I do this:
Hi I thought I would start a Tip discussion here.
First tip: fonts and ems
Don't use a calculator to find em values for your fontsizes. Let SASS do it.
EX: body { font-size: 16px }
Now I want a font-size of 24px for my h1 tag, but in ems.
I also want a line-height of 30px, but in ems
}
EASY
Hold on there buddy. What if the default font-size or container font-size is 12px or whatever, you may have to change it later etc. Maybe change the body font size to a variable. So $bodyfontsize. Then in your sums, 30em/$bodyfontsize;
I came across a similar problem before and instead have a mixin for creating REM's instead.
Basically if you set the html to have a default of 10px for the fontsize it makes it super easy to use. Example;
So in your styles do;
p {@include font-size(16);}Yay, font-size output in px followed by REM's for supporting browsers.
tsfd
nice with some feedback. Here's another tip:
Some people may not have use for this, but I keep it handy in my custom mixin library...
A great resource as well: http://bourbon.io/
I made a box-shadow mixin before starting to use compass;
Also another for transitions;
@andy_unleash - I used to do the box-shadow like that, but it doesn't work if you want to use multiple values for more than one drop shadow, or perhaps a drop and an inset. Now I do this:
The
...after the$valuemeans that it will just tack on anything else that you include, pretty handy.I've also just recently modified an opacity one for IE8 support:
I would use it like this:
And using the fancy math, IE would get its full value of
50.The other one that I use all the time is for
background-size: cover;:What I like about this one is that on any element that I need the
coveron, I can just add a class of.bgcoverto it, super handy.