CSS

Facebook Twitter

Get money, fuck bitches. jk

12 Little-Known CSS Facts. CSS is not an overly complex language.

12 Little-Known CSS Facts

But even if you’ve been writing CSS for many years, you probably still come across new things — properties you’ve never used, values you’ve never considered, or specification details you never knew about. In my research, I come across new little tidbits all the time, so I thought I’d share some of them in this post. Admittedly, not everything in this post will have a ton of immediate practical value, but maybe you can mentally file some of these away for later use. 1. The color Property Isn’t Just for Text. Client-side full-text search in CSS. Using data- attributes for indexation, and a dynamic stylesheet with a CSS3 selector for search, it is straightforward to implement a client-side full-text search in CSS rather than JavaScript.

Client-side full-text search in CSS

Here is an example. The Searchable List The Search Code. Single-direction margin declarations. 12 June, 2012 This morning I awoke to find Smashing Magazine had retweeted a tweet I made two months ago about how you should always try and apply margins in one direction only.

Single-direction margin declarations

This, like most rules in web development, is a very general (and breakable) rule. It’s even a rule you can opt not to follow at all, but after receiving a slew of Tweets asking why, I thought I’d write up why it’s a rule I live by, and one I’d recommend to anyone… I’m not sure how I arrived at this rule, but I’m really glad I did and I would likely never ever change it. The basic premise is that you should try and define all your margins in one direction. A Harder-Working Class. Class is only becoming more important. Focusing on its original definition as an attribute for grouping (or classifying) as well as linking HTML to CSS, recent front-end development practices are emphasizing class as a vessel for structured, modularized style packages. These patterns reduce the need for repetitive declarations that can seriously bloat file sizes, and instil human-readable understanding of how the interface, layout, and aesthetics are constructed.

In the next handful of paragraphs, we will look at how these emerging practices – such as object-oriented CSS and SMACSS – are pushing the relevance of class. We will also explore how HTML and CSS architecture can be further simplified, performance can be boosted, and CSS utility sharpened by combining class with the attribute selector. A primer on attribute selectors While attribute selectors were introduced in the CSS 2 spec, they are still considered rather exotic.

CSS3

CSS Ribbon Menu. Use CSS3 transitions and CSS2 pseudo-elements to create an animated navigation ribbon with minimal markup.

CSS Ribbon Menu

February 1, 2012 Browser Support IE8 and IE9 do not support CSS3 transitions, so the hover state will not be animated for those browsers. Otherwise it looks and functions the same, which I think is a very acceptable fallback. The HTML. Powerful New CSS- and JavaScript-Techniques (2012 Edition) Simpler CSS typing animation, with the ch unit. A while ago, I posted about how to use steps() as an easing function to create a typing animation that degrades gracefully.

Simpler CSS typing animation, with the ch unit

Today I decided to simplify it a bit and make it more flexible, at the cost of browser support. The new version fully works in Firefox 1+ and IE10, since Opera and WebKit don’t support the ch unit and even though IE9 supports it, it doesn’t support CSS animations. To put it simply, one ch unit is equivalent to the width of the zero (0) character of the font. How to adjust an iframe element’s height to fit its content. In an ideal world there would always be a clean way of displaying data supplied by a third party on your site.

How to adjust an iframe element’s height to fit its content

Two examples would be getting the data in JSON or XML format from a Web Service and having an API to code against. But you don’t always have any of those options. Sometimes the only way of incorporating data from a third party is by loading it in an iframe element. CSS Lifted corner Drop Shadow. .box{ width:200px; height:100px; .drop-shadow { position:relative; float:left; width:40%; padding:1em; margin:2em 10px 4em; background:#fff;

CSS Lifted corner Drop Shadow

Create an adaptable website layout with CSS3 media queries. Getting started Creating the default layout The first step of this tutorial is obviously to create a HTML page.

Create an adaptable website layout with CSS3 media queries

I chose to make a simple HTML5 page with only a header image, a title, and some text. Copy the following code and paste it into a file named index.html. <! Once done, we have to add a stylesheet to our index.html page. Right now, if you look to your index.html page through your web browser, you’ll see something like the screenshot below. Using CSS3 media queries to make our layout fit in all screen resolutions. Make a Footer Stick to the Bottom of the Page.

This CSS footer stylesheet will make a footer stick to the bottom of the page.

Make a Footer Stick to the Bottom of the Page

CSS Sticky Footer There are several ways to make a footer stick to the bottom of a page using CSS. But until now, they've used long and messy hacks or a lot of extra HTML markup; this method uses only 15 lines of CSS and hardly any HTML markup. Even better, it's completely valid CSS, and it works in all major browsers. Internet Explorer 5 and up, Firefox, Safari, Opera and more. View the example CSS Sticky Footer or the HTML5 Sticky Footer. How to use the CSS Sticky Footer on your website Add the following lines of CSS to your stylesheet. CSS Lint. Galen Gidman. Just over a week ago I announced my CSS3 sticky note experiment and the response was amazing. 30 Exceptional CSS Navigation Techniques. We’ve seen innovative ways in which designers and developers have used CSS to innovate upon its shortcomings.

30 Exceptional CSS Navigation Techniques

Here, you’ll find some of the best ways to use CSS for your website navigation. You’ll find a variety of techniques that truly showcase the capabilities of CSS. In this article, you will find a collection of excellent navigation techniques that use the CSS to provide users with an impressive interface. 1. The Menu menu. The 30 CSS Selectors you Must Memorize.

Twice a month, we revisit some of our readers’ favorite posts from throughout the history of Nettuts+. This tutorial was first published in November, 2010. So you learned the base id, class, and descendant selectors - and then called it a day? If so, you're missing out on an enormous level of flexibility. While many of the selectors mentioned in this article are part of the CSS3 spec, and are, consequently, only available in modern browsers, you owe it to yourself to commit these to memory. Let's knock the obvious ones out, for the beginners, before we move onto the more advanced selectors.

The star symbol will target every single element on the page. The * can also be used with child selectors. This will target every single element that is a child of the #container div. IE6+ Firefox Chrome Safari Opera Prefixing the hash symbol to a selector allows us to target by id. Rolling a coke can around with pure CSS.