<commit_before>---
layout: post
title: 3D Buttons with CSS3 gradients and Sass
published: true
author: <NAME>
author_url: http://github.com/dawid-sklodowski
author_avatar: http://www.gravatar.com/avatar/073c19a8d1fd30baa6dba34eaa55fe90.png
---
Visiting various pages on the web, we often see nice buttons looking like they are 3d.
In most cases those buttons are being made with image – gradients.
CSS3 allows us to create gradients without images, speeding up development and page-loading time.
Another important factor is their flexibility to change color and ability to scale with their containers.
Trying other colors for image-based buttons means changing colors of corresponding gradient-images,
what surely is a time-consuming process. 

![buttons](/images/2013-05-01/buttons.png)

<!--more-->

CSS gradients syntax is a bit cumbersome. So are brightness calculations for different shades of color.
To address this matter, I’ve come up with Sass mixin, which takes base color as argument:
{% highlight sass%}<commit_msg>Relative url to image<commit_after>---
layout: post
title: 3D Buttons with CSS3 gradients and Sass
published: true
author: <NAME>
author_url: http://github.com/dawid-sklodowski
author_avatar: http://www.gravatar.com/avatar/073c19a8d1fd30baa6dba34eaa55fe90.png
---
Visiting various pages on the web, we often see nice buttons looking like they are 3d.
In most cases those buttons are being made with image – gradients.
CSS3 allows us to create gradients without images, speeding up development and page-loading time.
Another important factor is their flexibility to change color and ability to scale with their containers.
Trying other colors for image-based buttons means changing colors of corresponding gradient-images,
what surely is a time-consuming process. 

![buttons](images/2013-05-01/buttons.png)

<!--more-->

CSS gradients syntax is a bit cumbersome. So are brightness calculations for different shades of color.
To address this matter, I’ve come up with Sass mixin, which takes base color as argument:
{% highlight sass%}
{'fraction_non_alphanumeric': 0.06938379427462397, 'fraction_numerical': 0.027171276079573023, 'mean_word_length': 4.841359773371105, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5998407', 'n_tokens_mistral': 605, 'n_tokens_neox': 547, 'n_words': 264}