In this movie, I want to explore some of the online tools that can help you
generate CSS, check your syntax, and help make your CSS more efficient.
One of the downsides to the rapid evolution of CSS is the ever-changing nature
of the syntax and the complexity of the vendor-specific prefixes.
Keeping track of all the changes can feel, at times, like a full-time job.
Well thankfully, for many of the newer CSS3 features, there are online tools
that not only help you keep up to date with the syntax, but will generate the
code for you as well.
I first want to introduce you to a few online tools that focus on generating the
syntax for the new features found in CSS3.
There are a surprising amount of these tools, and many do exactly the same thing.
So instead of experimenting with all of them, we will just preview a couple of
them to give you a feel for how they work and then show you where you can find
some of the other tools so that you can compare them on your own.
I want to start with perhaps the most simple, CSS3 Generator.
You start with a simple dropdown menu,
you choose the property you want to set, and then you begin a series of
questions or forms to generate the code.
So here, I have started with Border Radius, and the first thing that it does is
ask me if the borders are going to be rounded equally.
Well, let's just say Yes.
So now I can go ahead and enter in the amount that I want for the Border Radius,
let's say 20 pixels.
It gives me a nice preview area over here, and it also gives me the code that's
required to do that, including the vendor prefixes.
There is also this really nice little browser support future over here that
let's me see which browsers support it and which versions it's supported in.
A similar tool is CSS3 Generator.
You get to work visually with easy-to-use form controls to set the styling
that you're looking for.
Now, it has a smaller feature set than some of the other tools, but it is
incredibly easy to use.
So once again, let's say we wanted that twenty-pixel border radius.
So I can just go ahead and slide that, and you can see how this is changing over here.
I can also go ahead and toggle off whether I want minimal support for older
versions of Internet Explorer. And then when I am happy with what I've got, let's
just go ahead and add something like a box-shadow to it while we're at it.
And then once we are happy with it, we can click GET THE CODE and it generates a
nice little pop-up window where I can go ahead and copy this CSS and past it
directly into my own code. CSS3 please!
may look a little bit more complicated, but it's actually pretty simple.
You're provided with code samples for CSS3 features, which you can then modify
with your own settings.
So again, we can go into our border-radius here and modify that with our
own value of 20 pixels.
We can come into box-shadow and change some of those settings as well.
Now, unlike CSS3 Generator, you're expected to know how to modify the syntax and
what the values pertain to;
however, with a little experimenting, you can quickly learn quite a bit about
how the syntax works.
You can also toggle rules off and on to see how they would affect your
preview area here, and you can sort of invert the styling if you don't like
the darker background.
Once you're finished with your code, you can go ahead and click to copy it to
your clipboard and paste it into your own CSS.
You'll also want to check out layer styles, which gives you a floating palette,
not unlike Photoshop or other Adobe programs to kind of play around with.
CSS3 Playground, which includes a large amount of CSS properties, not just CSS3.
CSS3 Maker also provides you with a visual way to create CSS3 code.
If you're interested in CSS3 gradients, you really need to check out the
Ultimate CSS Gradient Generator.
CSS gradient syntax is extremely complex and has gone through many changes recently.
Not only does this tool keep you up with the syntax, it provides you with a
familiar way to build the gradient you're looking for.
If you've ever used Illustrator or Photoshop to build gradients, you are going
to be a right at home using this gradient generator.
Western Civ is a great CSS resource site, and they have multiple tools that you
are going to want to explore.
I love the XRAY bookmark that allows you to identify elements on the page and
how they are styled and the CSS3 Sandbox that contains tools that will generate
gradients, shadows, text strokes, and CSS transforms.
Now, keep in mind that although the authors of these tools generally do a pretty
good job in keeping them updated,
these are free services that are updated as time allows.
In the end, it's up to you to make sure that the generated code is correct and
uses the currently supported syntax.
With that in mind, generating CSS is one thing, making sure it's right is quite another.
Thankfully, there are online resources that can help us with that as well.
One way to test your CSS is to run it through the W3C's Markup
Validation Service.
This service will parse your code and return any errors that are found.
Now keep in mind that this is designed to make sure your code is standards
compliant, not that it's going to work in all browsers; still, it's a valuable
way to test your code and make sure it's been authored correctly.
For a more minute check, you might want to try CSS Lint.
CSS Lint will process any CSS you feed it and then check it against a host of
errors and warnings, some of those which you can see it right here.
Now one thing I want to mention is that many of these warnings are very subjective.
For example, the default setting will warn you if any IDs are found in your code
or if too many font sizes are declared. Not including IDs and selectors is a
totally subjective judgment, and one that not all designers, including myself
agree with. Plus there's no real way, without knowing the context of the web
site, whether or not there are too many font size declarations being used.
In the end, realize that CSS Lint is a tool that will help you write more
efficient CSS and pick up on errors, but don't take all its recommendations as gospel.
Well, those are a few of the tools that are available to you, to not only
write CSS, but keep up with the evolving syntax and to make sure that your code is error free.
Of course, there are many more online tools than the ones I've shown you here,
so be sure to research and experiment with as many tools as you can find.
Just be sure that any tool that you use creates valid efficient code and that
you're using it more as a learning tool and as a way to experiment with
properties, rather than relying on it to generate the code for you.