Thursday, March 17, 2011

Layout: StackLayout – Flexible & Modular CSS Layouts


CSS framework which supports both fluid and fixed-width layouts.
Compared to many popular grid systems, it only uses 12 class names in total and makes use of inline-block CSS property rather than floats.
Stacks can be nested infinitely which helps creating complicated layouts easily.
The framework has a component (a CSS file) which eases building cross-device compatible versions of websites.
StackLayout is compatible with most of the browsers, few old ones has some issues which can be fixed with the help of the documentation provided.

Friday, March 11, 2011

CSS: CSS Typography: Techniques and Best Practices

http://sixrevisions.com/css/css-typography-02/#more-5033

Just include a copy of the font’s file on your web server and use the @font-face rule in your CSS code as follows:

@font-face {
  font-family: CurlzMTRegular;
  src: url(fonts/CurlzMTRegular.eot);
}

Then just use the font-family declared above with your CSS:

h1, h2, h3, h4, h5, h6 {
  /* Always use a font stack, even with custom web fonts! */
  font-family: CurlzMTRegular, Helvetica, Arial, sans-serif;
}



The concept of vertical rhythm is simple: Line heights, margins, and padding should all be equal or within even proportion.

Here’s an example:

p, ol, ul, blockquote, pre, code {
  line-height: 18px;
  margin-bottom 18px;
  /* 1.5em provides good vertical spacing ( = 150% of the font-size) */
  line-height: 1.5em;
  margin-bottom: 1.5em;
}


CSS3 Text Shadows:

p {
  text-shadow: 1px 1px 1px #000;
}


To create inset text, you can use negative values as such:

h1  {
  /* Use negative offsets to create inset text. */
  text-shadow: #000 -1px -1px 0;
}


Friday, March 4, 2011

CSS: Reduce file size by effective CSS Coding

CSS: CSS Typography: The Basics

http://sixrevisions.com/css/css-typography-01/#more-5027
http://sixrevisions.com/css/css-typography-02/#more-5033


FONT:
font-sytle: oblique;
font-weight: bold;

TEXT:
text-indent: 50px; (indents the first line of a text block.)
letter-spacing: 2px;

OTHER:
Color: red; (controls an HTML element’s foreground color)
---------------------------------------------------------------
FONT SIZING:

Absolute-size:
xx-small, x-small, small, medium, large, x-large, xx-large.

Relative-size:
div {
  font-size: 12pt;
}
p {
  font-size: large;
}
As an example, if text is set to 12pt, the 'large' keyword will resize the child element’s text to about 12pt x 1.2 (depending on the browser), which would equal 14.4pt.

Absolute Lengths:
pt, px, mm, cm, in, and pc.

Millimeters (mm), centimeters (cm), and inches (in) are more suitable in print design. They are not very suitable for screen-based measurements because of the high variance of screen resolutions.

 If developing for an audience that will likely resize text manually through their web browser, the px unit of measurement may not be a good option.

Relative Lengths:
This means that their sizes are dependent on the font-size assigned to their parent element. Possible units are em, % and ex.

em and % values are far easier to work with. em and % act identically, and it’s just a matter of syntax:

0.5em is equal to 50%
1em is equal to 100%
0.2em is equal to 20%
0.73em is equal to 73%
2.21em is equal to 221%

html, body {
  font-size: 85%; /* = (.85em) */
}

h1 {
  font-size: 110%; /* = (1.1em) */
}
-----------------------------------

FONT STACKS:

So when developing font stacks:

Make sure you account for the different operating systems (Windows, Mac, and Linux).
Make sure a font stack is all sans serif or is all serif (for consistency)
Make sure the fonts in the stack have similar aspect ratios.
http://www.awayback.com/revised-font-stack/
-----------------------------------
CSS Typography Pseudo-classes and Pseudo-elements:


a:link { color: #666666; text-decoration: none; }
a:visited { color: #333333; }
a:hover { text-decoration: underline; }
a:active { color: #000000; }
----
First, Last, and n-th Pseudo-elements:

(Creating drop caps)
p:first-letter {
  font-size: 30pt;
  display: block;
  float: left;
  margin: 0 5px 5px 0;
}

(:first-line)
p:first-line {
  font-weight: bold;
  text-transform: uppercase;
}

( :nth-child() )
p:nth-child(2) {
  background: #e7f0ce;
  padding: 10px;
}

Also play around with :nth-child(even) and :nth-child(odd) pseudo-classes to grab even and odd elements.