Site Search

10 Top-Notch Ways to Freshen Up Your CSS

  • Pratip Biswas
  • Jun 11,2014
  • 5 minutes read
Table of contents

Technology needs an upturn or an upgrade, but with that comes a peculiar feeling “anything that can be done has been done.”As soon as a technology loses its shine and popularity, our interest wanes off and the attention shifts towards the next big thing.

Something similar happened with CSS; it was a revolution in its first launch and over the time, it helped designers to create flexible, tight-crafted and have some beautiful web page layouts. With time, various suggestions came up and said that CSS has worn out perhaps the sun has set.

Well, old should not always find its way to scrap… so we thought to breathe in new life to CSS for fellow developers. We prefer to highlight some cutting-edge features that you might not have explored.

Here is a revision, a recap, to open up new CSS opportunities for the designers of today!

1. Used Images Must Match Site’s Color Scheme

Color schemes of conferences along with many speakers, makes it complex to manage the workflow. Manually applying filters does not scale or relies on the access to specific actions such as Photoshop. You might use high resolution such as greyscale PNG and add up tones using CSS filters. This application can match the portraits to the event’s scheme, and you can reuse the images across multiple themes. Just need a CSS rule for each approach.

2. Use Transforms to Animate Polyhedra

CSS polygons, generally created with borders, but we ignore a more powerful tool compared to CSS polygons- the transform property. Applying transforms in the nested elements allows us to create complex polygons with image backgrounds or borders and transparent interiors. Using 3D transforms, we can combine 2D shapes into polyhedra and make the object merge, unfold, explode or recombine like WebGL.

3. Mastering the Use of Calc ()

Calc() is a wonderful application in CSS, useful to tame margins, padding or dimensions. It breathes in new life to designs looking for positioning or sizing backgrounds, inside gradients or transforms, not only brings a change to same old units, but also those new viewports.

4. Sane Use of Box-Sizing

Restore your sanity, with the proper use of box sizing. Without it, you cannot manage an element of defined width after you use padding to increase or decrease its width that makes pixels and percentage tough. With box sizing: border-box, borders and padding is easy to place within a defined width.

5. Take Hyphenation under Your Control

In print, hyphenation is taken for grant, and some designers use property available online, as few are aware of other features that provides a fine control over hyphenation. If designers are not careful, hyphenation ladders come up in different sections and the hyphen’s reign across multiple lines. The general rule of thumb says not to use hyphens more than two in a row. Use of hyphenate-limit-lines and hyphenate-limit-chars can specify the minimum length of the word that will be hyphenated, along with a minimum number of characters before and after the hyphen pause.

6. Look into the Available Writing Modes

Writing modes helps designers to define the direction in which the text should flow. Some of the East Asian scripts written vertically from right to left, so specified with a writing mode – vertical-rl (tb-rl in IE). Vertical text is of no use in European writing. Instead, devs can use it as table headings if the pages have limited horizontal space.

7. Unusual Ways to use Gradients

Background gradients at times can look great if you merge them with definite borders and bullets. With the use of preprocessor, you can mix the reused code, so as not to repeat it manually. Do not go crazy over it, since gradients can be heavy for the processors.

8. Make Use of String Matching on Links

Designers can take the advantage of string-matching to style the social icons. To match the right link with the correct style icon use a string-match on the href attribute of the anchor element. Use *= so the href anchor of the element that contains only a string that users specify.

9. SVG for the Backgrounds

IE 8 and Android 2 WebKit are the only browsers without SVG support, so using SVG for the backgrounds in CSS is feasible, especially along with a PNG fallback solution like Grunticon. CSS can style SVG, and you can have an interesting bleed-through of CSS filters from SVG that you can play with HTML.

10. Use ‘:target’ in Page Elements

CSS is not a programming language originally, but you can do many things on it without referring back to JavaScript. Take the example of ‘:target,’ a pseudo-class applied to elements that are targets of the clicked link. Yes, you can use this to define the state of a page, target a parent containing lot of elements and your links become the means to control look and layout of all children at a single click.

Phew!! We did it. Freshened your thoughts and renewed your view on CSS. Hope, now you can see some new possibilities in web development and design with CSS. We expect that before pushing the CSS to scrapyard you will like to test these techniques.

Unified always have a different way to look at the web designing world, this small initiatives taken by us can surely help developers to have a unique exposure in the market.


icon

Pratip Biswas

Founder & CEO, Unified Infotech

"Pratip Biswas, founder and CEO of Unified Infotech, has driven the company to become a leader in next-gen digital transformation. He has a deep-rooted passion for technology and innovation. With his visionary approach and expertise, he has been transforming ideas into reality for entrepreneurs and businesses.”