Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Erik Nuber
20,629 PointsCSS extensions. When to use, how to figure out which to use for...etc.
I am struggling a bit with trying to figure out how to know what CSS properties need extensions.
I found a handy site called autoprefixer.
https://autoprefixer.github.io
that you paste your code in, it finds any problems, which for me caught a single missed semi-colon.
Then, when your css is corrected it gives you back your code with the extensions added in.
However, as I am checking it out line by line to see what was done, I found a section that is below. In that section it uses terms I wasn't familiar with so I looked them up and, got the warning that will follow below.
.flipOverlay, .slideOverlay, .adOverlay {
color: #fff;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
padding-left: 20px;
padding-right: 20px;
display: -webkit-box;
display: -ms-flexbox;
display: flex; /*necessary to center text within overlay*/
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
background: rgba(0,0,0, .5);
}
Here are a couple of the warnings as found on MDN
for box-orient: Warning: This is a property of the original CSS Flexible Box Layout Module draft, and has been replaced in newer drafts.
for box-direction: Warning: This property reflects an old version of the CSS Flexible Box Layout Module standard. The -moz-box-direction will only be used for XUL while the previous standard box-direction has been replaced by flex-direction.
My question is how do I know when to leave things in and when they are no longer necessary. The autoprefixer from what I have been able to find online states that it is updated to reflect current information so when a prefix is no longer needed, it will automatically take it out of your code and fix it properly. I found some charts that list things that need prefixes, I am just unsure what is actually current and how to find that information out.
Thanks!
2 Answers
Kevin Korte
28,149 PointsYou can generally ignore these warnings, because you're covered by display: flex; and flex-direction: column;. Browsers, (which are most today) that support these two rules will use them, and ignore the rules that are throwing the warning.
I believe by default, autoprefixer goes back two versions, but it's also highly customizable. It uses data from http://caniuse.com to decide if it needs to provide and extension.
Erik Nuber
20,629 PointsGreat...that caniuse.com was what I was looking for and couldn't remember. Will book mark it.
Appreciate the info. Some of my corrections I made with extensions were altered by autoprefixer and I'm more inclined to follow it for current/correct way.