5 Cool CSS Tricks To Spice Up Your Website



CSS tricks

CSS is a basic part of any webpage, and is what gives the page its distinctive look. CSS can be simple yet complicated at the same time, from a simple typography rule to a complex animation. It can be used to create amazing things. Today, we'll share some CSS styles which you might useful, and may use on your website to spice things up a bit.


1. Blurry text



Blurry text has a certain appeal, and is often used to direct attention towards a specific piece of text. Not to mention it looks cool :) Here's the CSS for making some text blurry. The trick is to fist make the text transparent, then add a drop shadow like so;



.blurry-text {


   color: transparent;


   text-shadow: 0 0 5px rgba(0,0,0,0.5);


}



Here's a sample text that is really blurry.


2. Animated gradient




Sounds cool, right? Well it is. Strictly speaking, you cannot animate a gradient color unlike some of the other CSS properties. You can, however, move the background around to make it look like it's animated.





button {


    background-image: linear-gradient(#518712, #124555);


    background-size: auto 200%;


    background-position: 0 100%;


    transition: background-position 0.5s;


}


button:hover {


    background-position: 0 0;


}




3. Image Grayscale




Grayscale tones up an image and makes it look classy and cool. You can apply an SVG filter to an image to turn it into grayscale.





<svg xmlns="http://www.w3.org/2000/svg">


    <filter id="grayscale">


        <feColorMatrix type="matrix" values="0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"/>


    </filter>


</svg>




img {


    filter: url(filters.svg#grayscale); /* Firefox 3.5+ */


    filter: gray; /* IE6-9 */


    -webkit-filter: grayscale(1); /* Google Chrome, Safari 6+ & Opera 15+ */







4. Customizing link types





You can use CSS to customize how different types of links appear based on their file formats. You can set http:// links to appear a certain way, and mailto: and .pdf files to appear another. Here's the CSS;



a[href^="http://"]{


    padding-right: 20px;


    background: url(external.gif) no-repeat center right;


}


/* emails */


a[href^="mailto:"]{


    padding-right: 20px;


    background: url(email.png) no-repeat center right;


}


/* PDFs */


a[href$=".pdf"]{


    padding-right: 20px;


    background: url(pdf.png) no-repeat center right;


}



5. Vertical alignment




Vertically aligning something can be a real pain. There's no simple property you can apply to everything. Here is, however, a CSS3 transform style which you can use to vertically align anything.




.verticalcenter {


    position: relative;


    top: 50%;


    -webkit-transform: translateY(-50%);


    -o-transform: translateY(-50%);


    transform: translateY(-50%);


}




Got any more cool CSS tricks you want to share with us? Let us know in the comments section below! Cheers :)

Related Posts:

  • Subscription Box: Add an Attractive One Below PostsAlhamdulillah I am back to work and today we are going to make a high quality RSS subscription box with no images or complex scripts. Alerting your visitors to subscribe at the bottom of your posts often help in increasing th… Read More
  • Heading Tag With Drop Shadow and Mouse Hover Effect Blogger blogs has the free option of editing the style sheet. Fortunately you can play around the codes to give your blog any look you want. Last year I shared various ways of customizing the heading tags i.e. H3. We use H3… Read More
  • Create a Simple "Tree Menu" in BloggerEver wondered to create an expandable Tree menu in a simple one step method? There we have it today! A Tree Menu is different from other navigation menus that we have released so far. It has has branches and sub-branches. You… Read More
  • Glossy Red-Grey Tabs MenuThis new menu has two different variations. The color combination can either be red in active mode and grey on mouse hover or vice versa. It is a shiny navigation menu that is mainly created for including blogger pages such a… Read More
  • Change Size, Font Family and Color Of Custom Search EngineGoogle Custom Search Engine is another option that Adsense provides to increase your blog revenue. I shared detailed posts on how to create a custom search engine and integrate adsense in it. However the problem with the cust… Read More