Tag: CSS

How To Create Github-style “Fork Me” Ribbons Using Only CSS

Githubribbons

Can you create a “Fork Me On Github” ribbon using only CSS? And have it say some other message?

That was the question I asked myself while working on a new website (for the new job). You see, the new website is going to go online in a “preview” mode and I wanted some way to very clearly indicate to visitors that the site is still in development. I’ve seen the Github ribbons on many project sites and thought this might be a great way to do the kind of marking that I want to do.

The problem is that the “official” Github Ribbons are simply images that are overlaid on your site using absolute positioning in CSS.

With an image, of course, I can’t modify the text to have my own message. And while the PSD files are available for the ribbons, I didn’t want to get into modifying images.

I figured with the modern browsers we have I ought to somehow be able to do this using plain old text and Cascading Style Sheets.

Thankfully, I found out that Daniel Perez Alvarez had already done this with a wonderful walk-through:

He steps right through the process showing you exactly what you need to do in CSS to approximate the images.

John Balogh from Mozilla wrote a similar post a bit earlier with a slightly different recipe:

Both posts were helpful to me in learning more about how you can manipulate text using CSS.

Of course, the question is…

WILL THIS WORK IN MANY BROWSERS?

Daniel Perez Alvarez includes a table at the end of his post showing which browsers would support this technique as of when he wrote the post in October 2009. I’d like to hope that two years later more browsers will support these techniques… but then again, there are still people out there using IE6 so we can’t expect newer browsers to be widely deployed.

Still, for the target audience for my new website I’m going to expect many of the users will be using newer browsers – and I’m going to see what I can do to make it degrade gracefully (as in, not appear) for older browsers.

My ribbon looks great… and no, I can’t show it to you yet. 😉

Thanks to both Daniel Perez Alvarez and John Balogh for posting their tutorials online.

Using LESS To Create Dynamic Stylesheets with Node.js

Have you been working with Cascading Style Sheets (CSS) and found yourself wishing you could make those sheets more, oh, dynamic? Like, for instance, including variables so that you could easily change colors or spacing throughout a stylesheet? There are a number of solutions out there to do this, but one I stumbled upon recently is “LESS“. Here’s a graphic from the LESS site that shows exactly this usage with variables:

less.jpg

You can also do some very cool things with easily nesting rules and creating functions that can calculate values for other rules.

All in all it looks very cool… and it can run either in a client browser or, of more interest to me, server-side using Node.js. I have a site idea where this just might come in handy…

P.S. Any other modules for Node.js for doing stylesheet creation that you all like?