Organic-Intelligence.com
Home | About Us | Blog | Web Technologies | SEO | Job Seeker
 

CSS Tricks and Tips


1. CSS Vertically aligning

Using CSS layout style "vertical-align: middle" will not make the content to line up in the middle of a container. Here is the solution: set the line-height to the same height as the container itself. for example, if the container is 30px, then you set 30px as line-heigh for the content box.

2. Multiple Classes together

You could assign a class attribute with two or more classes. CSS alllows you apply styles from mutiple classes to any element. For example:
 <div class="class1 class2 class3"> CSS Examples </div>
 
You should use a whitespace not a comma to seperate each class. If any rules overlap, then the overriding class will take precedence.
3. Inheritance Inheritance, as the name suggests, a child element should inherit the property of its parent, for example:
body {font-family: Verdana;}
p {font-family: inherit;} 
All the paragraphs will have the same font.
a:link, a:visited {font-size: inherit;} 
The above code will make all the links the same font size as their surrounding text.