<?xml version="1.0"?>
<rss version="2.0" >
	<channel>
		<title>cssdog.com :: CSS Tutorials for beginners to advanced developers - Learning Cascading Style Sheet in simple and easy steps with examples. A complete reference manual for CSS2 and CSS3 properties, html, CSS, webdesign tips, site creation, layout and web2.0</title>
		<link>http://www.cssdog.com/</link>
		<description>CSS Tutorials for beginners to advanced developers - Learning Cascading Style Sheet in simple and easy steps with examples. A complete reference manual for CSS2 and CSS3 properties

Cascading Style Sheets, fondly referred to as CSS, is a simple design language intended to simplify the process of making web pages presentable.

CSS handles the look and feel part of a web page. Using CSS, you can control the color of the text, the style of fonts, the spacing between paragraphs, how columns are sized and laid out, what background images or colors are used, as well as a variety of other effects.

CSS is easy to learn and understand but it provides powerful control over the presentation of an HTML document. Most commonly, CSS is combined with the markup languages HTML or XHTML. Learn how to use CSS instead of technology. 
</description>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<generator>Jitbit RSS Feed Creator</generator>
		<pubDate>Mon, 01 Dec 2008 13:14:21 +0600</pubDate>
		<item><title>CSS - Shortcuts | Writing Efficient CSS</title><description><![CDATA[<H1>CSS - shorthand properties</H1>
<P>Learn how to make your pages load faster using CSS shorthand properties for backgrounds, borders, colours, fonts, lists, margins, padding, and outlines.<BR><BR>One of the main advantages of using <ACRONYM title="Cascading Stylesheets">CSS</ACRONYM> is the large reduction in web page download time. To style text, you used to have to use the &lt;font&gt; tag over and over again. You probably also laid out your site with tables, nested tables and spacer gifs. Now all that presentational information can be placed in one <ACRONYM title="Cascading Stylesheets">CSS</ACRONYM> document, with each command listed just once.</P>
<P>But why stop there? By using <ACRONYM title="Cascading Stylesheets">CSS</ACRONYM> shorthand properties you can reduce the size of your <ACRONYM title="Cascading Stylesheets">CSS</ACRONYM> document even more.<BR><BR>Let us look at an example to have a better idea. To add CSS style to the body tag in HTML you can write this:</P>
<BLOCKQUOTE>body { background: url("test.gif"); background-color: #fff; background-repeat: repeat-x; } </BLOCKQUOTE>
<P>The above code is a common way of using CSS by happy coders all over the world. Now let's see what happens if we try to define the same style, but this time by using a shortcut. We use the property <EM>background</EM> and this makes us able to set values for all the above properties with more efficiency, in fact we're close to cutting the amount of code in half:</P>
<BLOCKQUOTE>body {background: url("test.gif") #fff repeat-x}</BLOCKQUOTE>
<P>So as you can see, there's plenty of room to make your CSS more efficiant if you know how to put the shorthand properties to work.</P>
<P>Under each header in this article I present the shorthand in the same way as above. First the browser support will be indicated, then the syntax in which the shorthand is being used, and then an example with a short explanation.</P>
<H2>Font</H2>
<P>Use:</P>
<P>font: 1em/1.5em bold italic serif</P>
<P>...instead of</P>
<P>font-size: 1em;<BR>line-height: 1.5em;<BR>font-weight: bold;<BR>font-style: italic;<BR>font-family: serif </P>
<P>This <ACRONYM title="Cascading Stylesheets">CSS</ACRONYM> shorthand property will only work if you're specifying both the <A href="http://www.cssdog.com/css_font-size.html">font-size</A> and the<A href="http://www.cssdog.com/css_font-family.html"> font-family</A> - omit either and the <ACRONYM title="Cascading Stylesheets">CSS</ACRONYM> rule will be completely ignored. Also, if you don't specify the font-weight, font-style, or font-varient then these values will automatically default to a value of normal, so do bear this in mind too.</P>
<H2>Background</H2>
<P>Use:</P>
<P>background: #fff url(image.gif) no-repeat top left</P>
<P>...instead of</P>
<P>background-color: #fff;<BR>background-image: url(image.gif);<BR>background-repeat: no-repeat;<BR>background-position: top left; </P>
<P>Omit any of these commands from the background <ACRONYM title="Cascading Stylesheets">CSS</ACRONYM> shorthand property, and the browser will use the default values. If you leave out the <A href="http://www.cssdog.com/css_background-position.html">background-position</A> command then any <A href="http://www.cssdog.com/css_background-image.html">background image</A> will be place in the top-left of the container and then repeated both horizontally and vertically.</P>
<H2>Lists</H2>
<P>Use:</P>
<P>list-style: disc outside url(image.gif)</P>
<P>...instead of</P>
<P>list-style: #fff;<BR>list-style-type: disc;<BR>list-style-position: outside;<BR>list-style-image: url(image.gif) </P>
<P>Leave out any of these <ACRONYM title="Cascading Stylesheets">CSS</ACRONYM> commands from the shorthand rule, and the browser will use the default values for each, namely disc, outside and none (i.e. no images) respectively.</P>
<H2>Margin &amp; padding</H2>
<P>There are a number of different <ACRONYM title="Cascading Stylesheets">CSS</ACRONYM> shorthand commands for margin and padding, depending on how many of the sides of the containing element have the same <A href="http://www.cssdog.com/css_margin.html">margin</A> or <A href="http://www.cssdog.com/css_padding.html">padding</A> values:</P>
<H3>Four different values</H3>
<P>Use:</P>
<P>margin: 4px 1px 3px 4px (<EM>top, right, bottom, left</EM>)</P>
<P>...instead of</P>
<P>margin-top: 4px;<BR>margin-right: 1px;<BR>margin-bottom: 3px;<BR>margin-left: 4px </P>
<H3>Three different values</H3>
<P>Use:</P>
<P>margin: 5em 1em 3em (<EM>top, right and left, bottom</EM>)</P>
<P>...instead of</P>
<P>margin-top: 5em;<BR>margin-right: 1em;<BR>margin-bottom: 3em;<BR>margin-left: 1em </P>
<H3>Two different values</H3>
<P>Use:</P>
<P>margin: 5% 1% (<EM>top and bottom, right and left</EM>)</P>
<P>...instead of</P>
<P>margin-top: 5%;<BR>margin-right: 1%;<BR>margin-bottom: 5%;<BR>margin-left: 1% </P>
<H3>One different value</H3>
<P>Use:</P>
<P>margin: 1 (<EM>top, bottom, right and left</EM>)</P>
<P>...instead of</P>
<P>margin-top: 1;<BR>margin-right: 1;<BR>margin-bottom: 1;<BR>margin-left: 1 </P>
<P>The above rules also apply to <A href="http://www.cssdog.com/css_padding.html">padding</A> and<A href="http://www.cssdog.com/css_border.html"> border</A> (see below for more on border).</P>
<H2>Border</H2>
<P>Use:</P>
<P>border: 1px black solid</P>
<P>...instead of</P>
<P>border-width: 1px;<BR>border-color: black;<BR>border-style: solid </P>
<P>Use:</P>
<P>border-right: 1px black solid</P>
<P>...instead of</P>
<P>border-right-width: 1px;<BR>border-right-color: black;<BR>border-right-style: solid </P>
<P>(You can substitute right with top, bottom or left.)</P>
<P>The above <ACRONYM title="Cascading Stylesheets">CSS</ACRONYM> shorthand rules can be conveniently combined with the shorthand rules used by margin and <A href="http://www.cssdog.com/css_padding.html">padding</A>. Take a look at the following box:</P>
<P><IMG class=img1 alt="Blank image, with light blue top and left borders, and dark blue bottom and right borders. The top and left borders are slightly thicker" src="http://www.cssdog.com/images/box.gif" width=30 border=0></P>
<P>These borders can be achieved with the following <ACRONYM title="Cascading Stylesheets">CSS</ACRONYM> command:</P>
<P>border: 8px solid #336;<BR>border-left: 10px solid #ccf;<BR>border-top: 10px solid #ccf </P>
<P>You can achieve exactly the same effect by using:</P>
<P>border: 8px solid #336;<BR>border-width: 10px 8px 8px 10px<BR>border-color: #ccf #336 #336 #ccf</P>
<H2>List-style</H2>
<P>Use:</P>
<P><STRONG>The list-style shorthand property</STRONG> isn’t used all that often, but it can save you a couple of lines of code. It combines the list-style-position property with either of the list-style-type or list-style-image properties – you could probably specify both, but list-style-image would overwrite the list-style-type property with whatever image you selected. So instead of writing this:</P><PRE>ul {  	list-style-type: square;  	list-style-position: inside; }</PRE>
<P>You could write this:</P><PRE>ul { list-style: square inside; }</PRE>
<P>Generally speaking, however, I tend to only use this shorthand when I’m looking to remove styling from the list (as when building a navigation bar):</P><PRE>ul { list-style: none; }</PRE><BR>
<H2>header tag</H2>
<P>Use:</P>
<P>For example, the H1 tag shown below uses longhand CSS syntax. Note that the font-variant, font-stretch, font-size-adjust, and font-style properties have been assigned their default&nbsp;values.</P><PRE>H1 {  font-weight: bold;   font-size: 16pt;  line-height: 18pt;<BR>
     font-family: Arial;   font-variant: normal;  font-style: normal;<BR>
     font-stretch: normal;  font-size-adjust: none    }  </PRE>
<P>Rewritten as a single, shorthand property, the same tag appears as follows:</P><PRE>H1 { font: bold 16pt/18pt Arial }  </PRE>
<P>When written using shorthand notation, omitted values are automatically assigned their default values. Thus, the previous shorthand example omits the font-variant, font-style, font-stretch, and font-size-adjust tags.</P>
<H2>Conclusion</H2>
<P><ACRONYM title="Cascading Stylesheets">CSS</ACRONYM> shorthand properties are great! They're a great way to reduce the amount of code contained in a <ACRONYM title="Cascading Stylesheets">CSS</ACRONYM> document, allowing for faster download times and easier editing. Now we've learned that the CSS shorthand are quicker and more efficient to use in many situations. </P>]]></description>
<guid>http://www.cssdog.com/css_shortcuts.html</guid>
<link>http://www.cssdog.com/css_shortcuts.html</link><pubDate>Mon, 01 Dec 2008 13:14:21 +0600</pubDate></item>
		<item><title>CSS Selectors explained</title><description><![CDATA[<H1>CSS 3 selectors </H1>
<P>If we look a little further ahead, there are even more powerful selectors waiting to be implemented and used in CSS 3. Many of the CSS 3 selectors have already been implemented in modern browsers, but in general support is far too patchy for developers to rely on these new selectors. However, there are cases where they can be used to add nice forward enhancing features, so I think taking a look at how the new selectors in CSS 3 work can be useful.</P>
<P>In this article, the specification I am referring to is the <A href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215/">Selectors W3C Working Draft </A>. The new selectors described in the document will be used by CSS level 3, but may also be used by other languages. If you are reading this article months, or even years after that date it may be worth checking if a more recent version is available.</P>
<P>I am not going to explain the basics of how CSS selectors in general work here.</P>
<P>First, a quick overview of the selectors that are new in CSS 3:</P>
<TABLE class=src cellPadding=5 border=1>
<CAPTION><STRONG>Overview of CSS 3 selector syntax </STRONG></CAPTION>
<THEAD>
<TR>
<TH>Selector type</TH>
<TH>Pattern</TH>
<TH>Description</TH></TR></THEAD>
<TBODY>
<TR>
<TD>Substring matching attribute selector</TD>
<TD>E[att^=”val”]</TD>
<TD>Matches any E element whose att attribute value begins with “val”.</TD></TR>
<TR>
<TD>Substring matching attribute selector</TD>
<TD>E[att$=”val”]</TD>
<TD>Matches any E element whose att attribute value ends with “val”.</TD></TR>
<TR>
<TD>Substring matching attribute selector</TD>
<TD>E[att*=”val”]</TD>
<TD>Matches any E element whose att attribute value contains the substring “val”.</TD></TR>
<TR>
<TD>Structural pseudo-class</TD>
<TD>E:root</TD>
<TD>Matches the document’s root element. In HTML, the root element is always the HTML element.</TD></TR>
<TR>
<TD>Structural pseudo-class</TD>
<TD>E:nth-child(n)</TD>
<TD>Matches any E element that is the n-th child of its parent.</TD></TR>
<TR>
<TD>Structural pseudo-class</TD>
<TD>E:nth-last-child(n)</TD>
<TD>Matches any E element that is the n-th child of its parent, counting from the last child.</TD></TR>
<TR>
<TD>Structural pseudo-class</TD>
<TD>E:nth-of-type(n)</TD>
<TD>Matches any E element that is the n-th sibling of its type.</TD></TR>
<TR>
<TD>Structural pseudo-class</TD>
<TD>E:nth-last-of-type(n)</TD>
<TD>Matches any E element that is the n-th sibling of its type, counting from the last sibling.</TD></TR>
<TR>
<TD>Structural pseudo-class</TD>
<TD>E:last-child</TD>
<TD>Matches any E element that is the last child of its parent.</TD></TR>
<TR>
<TD>Structural pseudo-class</TD>
<TD>E:first-of-type</TD>
<TD>Matches any E element that is the first sibling of its type.</TD></TR>
<TR>
<TD>Structural pseudo-class</TD>
<TD>E:last-of-type</TD>
<TD>Matches any E element that is the last sibling of its type.</TD></TR>
<TR>
<TD>Structural pseudo-class</TD>
<TD>E:only-child</TD>
<TD>Matches any E element that is the only child of its parent.</TD></TR>
<TR>
<TD>Structural pseudo-class</TD>
<TD>E:only-of-type</TD>
<TD>Matches any E element that is the only sibling of its type.</TD></TR>
<TR>
<TD>Structural pseudo-class</TD>
<TD>E:empty</TD>
<TD>Matches any E element that has no children (including text nodes).</TD></TR>
<TR>
<TD>Target pseudo-class</TD>
<TD>E:target</TD>
<TD>Matches an E element that is the target of the referring URL.</TD></TR>
<TR>
<TD>UI element states pseudo-class</TD>
<TD>E:enabled</TD>
<TD>Matches any user interface element (form control) E that is enabled.</TD></TR>
<TR>
<TD>UI element states pseudo-class</TD>
<TD>E:disabled</TD>
<TD>Matches any user interface element (form control) E that is disabled.</TD></TR>
<TR>
<TD>UI element states pseudo-class</TD>
<TD>E:checked</TD>
<TD>Matches any user interface element (form control) E that is checked.</TD></TR>
<TR>
<TD>UI element fragments pseudo-element</TD>
<TD>E::selection</TD>
<TD>Matches the portion of an element E that is currently selected or highlighted by the user.</TD></TR>
<TR>
<TD>Negation pseudo-class</TD>
<TD>E:not(s)</TD>
<TD>Matches any E element that does not match the simple selector s.</TD></TR>
<TR>
<TD>General sibling combinator</TD>
<TD>E ~ F</TD>
<TD>Matches any F element that is preceded by an E element.</TD></TR></TBODY></TABLE>
<P><BR>Each selector will be described in more detail show in the bellow, and there are examples of how each selector can be used.</P>
<H2>Substring matching attribute selectors</H2>
<P>This whole group of selectors is new, and the selectors in it let developers match substrings in the value of an attribute.</P>
<P>Assume that you have an HTML document that contains the following markup structure:</P>
<OL>
<LI>&lt;div id="nav-primary"&gt;&lt;/div&gt; </LI>
<LI>&lt;div id="content-primary"&gt;&lt;/div&gt; </LI>
<LI>&lt;div id="content-secondary"&gt;&lt;/div&gt; </LI>
<LI>&lt;div id="tertiary-content"&gt;&lt;/div&gt; </LI>
<LI>&lt;div id="nav-secondary"&gt;&lt;/div&gt; </LI></OL>
<P>By using the substring matching attribute selectors you can target combinations of these structural parts of the document.</P>
<P>The following rule will set the background colour of all div elements whose id begins with “nav”:</P>
<OL>
<LI>div[id^="nav"] { background:#ff0; } </LI></OL>
<P>In this case the selector will match div#nav-primary and div#nav-secondary.</P>
<P>To target the div elements whose id ends with “primary”, you could use the following rule:</P>
<OL>
<LI>div[id$="primary"] { background:#ff0; } </LI></OL>
<P>This time the selector will match div#nav-primary and div#content-primary.</P>
<P>The following rule will apply to all div elements whose id contain the substring “content”:</P>
<OL>
<LI>div[id*="content"] { background:#ff0; } </LI></OL>
<P>The elements that will be affected by this rule are div#content-primary, div#content-secondary, and div#tertiary-content.</P>
<P>The substring matching attribute selectors are all fully supported by the latest versions of Mozilla, Firefox, Flock, Camino, Safari, OmniWeb, and Opera, so if it wasn’t for Internet Explorer we could start using them now.</P>
<H2>The :target pseudo-class</H2>
<P>URLs with fragment identifiers (an octothorpe, “#”, followed by an anchor name or element id) link to a certain element within the document. The element being linked to is the target element, and the :target pseudo-class makes it possible to style that element. If the current URL has no fragment identifier, the :target pseudo-class does not match any element.</P>
<P>Assuming the HTML structure mentioned earlier in this document, the following rule would put an outline around div#content-primary when the URL contains that fragment identifier:</P>
<OL>
<LI>div#content-primary:target { outline:1px solid #300; } </LI></OL>
<P>An example of such an URL is http://www.example.com/index.html#content-primary.</P>
<P>The :target pseudo-class is currently supported by browsers based on Mozilla and Safari.</P>
<H2>UI element states pseudo-classes</H2>
<H2>The :enabled and :disabled pseudo-classes</H2>
<P>The :enabled and :disabled pseudo-classes allow developers to specify the appearance of user interface elements (form controls) that are enabled or disabled, provided that the browser allows styling of form controls. The following rules will apply different background colours to single line text inputs depending on whether they are enabled or disabled:</P>
<OL>
<LI>input[type="text"]:enabled { background:#ffc; } </LI>
<LI>input[type="text"]:disabled { background:#ddd; } </LI></OL>
<H2>The :checked pseudo-class</H2>
<P>The :checked pseudo-class allows developers to specify the appearance of checked radio and checkbox elements. Again, this is provided that the browser allows styling of form controls. This CSS rule will apply a green border to checked radio and checkbox elements:</P>
<OL>
<LI>input:checked { border:1px solid #090; } </LI></OL>
<P>The UI element states pseudo-classes are currently supported by Opera and browsers based on Mozilla.</P>
<P>&nbsp;</P>
<H2>Structural pseudo-classes</H2>
<P>The structural pseudo-classes allow developers to target elements based on information that is available in the document tree but cannot be matched by other simple selectors or combinators. The structural pseudo-classes are very powerful, but unfortunately current browsers only support a few of them.</P>
<H2>The :root pseudo-class</H2>
<P>The :root pseudo-class targets the document’s root element. In HTML, the root element is always the HTML element, which means that the following two rules are the same (well, almost - :root has a higher specificity than html):</P>
<OL>
<LI>:root { background:#ff0; } </LI>
<LI>html { background:#ff0; } </LI></OL>
<P>The :root pseudo-class is currently supported by browsers based on Mozilla and Safari.</P>
<H2>The :nth-child() pseudo-class</H2>
<P>The :nth-child() pseudo-class targets an element that has a certain number of siblings before it in the document tree. This argument, which is placed within the parentheses, can be a number, a keyword, or a formula.</P>
<P>A <STRONG>number</STRONG> b matches the b-th child. The following rule applies to all p elements that are the third child of their parent element:</P>
<OL>
<LI>p:nth-child(3) { color:#f00; } </LI></OL>
<P>The <STRONG>keywords</STRONG> odd and even can be used to match child elements whose index is odd or even. The index of an element’s first child is 1, so this rule will match any p element that is the first, third, fifth, and so on, child of its parent element:</P>
<OL>
<LI>p:nth-child(odd) { color:#f00; } </LI></OL>
<P>The following rule matches p elements that are the second, fourth, sixth, and so on, child of their parent element:</P>
<OL>
<LI>p:nth-child(even) { color:#f00; } </LI></OL>
<P>The <STRONG>formula</STRONG> an + b can be used to create more complex repeating patterns. In the formula, a represents a cycle size, n is a counter starting at 0, and b represents an offset value. All values are integers. Understanding how this works is easier when you look at a few code examples, so let’s do that.</P>
<P>The following rules will match all p elements whose index is a multiple of 3. In the first rule, b is zero and could have been omitted, as in the second rule:</P>
<OL>
<LI>p:nth-child(3n+0) { color:#f00; } </LI>
<LI>p:nth-child(3n) { color:#f00; } </LI></OL>
<P>The offset value can be used to define at which child a repeating rule starts to apply. If you have a data table with 20 rows and want every odd row after the tenth row to have a different background colour, you can use this rule:</P>
<OL>
<LI>tr:nth-child(2n+11) { background:#ff0; } </LI></OL>
<P>Since n starts at 0, the first tr element to be affected is the 11th. Next is the 13th, then the 15th, and so on.</P>
<P>More details are available in the <A href="http://www.w3.org/TR/css3-selectors/#nth-child-pseudo">:nth-child() pseudo-class</A> section of the CSS 3 Selectors specification.</P>
<P>So, what about browser support for this very useful selector? Not good at all. As far as I can tell, no browser supports this or any of the other “nth” selectors. Please correct me if you know otherwise.</P>
<H2>The :nth-last-child() pseudo-class</H2>
<P>The :nth-last-child() pseudo-class works just like the :nth-child() pseudo-class, except that it targets an element that has a certain number of siblings <STRONG>after</STRONG> it in the document tree. In other words, it starts counting from the last child instead of the first, and counts backwards. The following rule will match the second-to-last tr element of a table:</P>
<OL>
<LI>tr:nth-last-child(2) { background:#ff0; } </LI></OL>
<P>The :nth-last-child() pseudo-class is currently not supported by any browsers.</P>
<H2>The :nth-of-type() pseudo-class</H2>
<P>The :nth-of-type() pseudo-class works exactly like the :nth-child() pseudo-class, but only counts those elements that are of the same type as the element the rule is applied to. This rule will match every p element that is the third p element of its parent:</P>
<OL>
<LI>p:nth-of-type(3) { background:#ff0; } </LI></OL>
<P>This can be useful if you want to make sure that you are really targeting the third p element. At first you might think that you could just as well use the nth-child pseudo-class, but :nth-child(3) will take all sibling elements into account, so the result will be different unless all p elements only have siblings that are also p elements.</P>
<P>The :nth-of-type() pseudo-class is currently not supported by any browsers.</P>
<H2>The :nth-last-of-type() pseudo-class</H2>
<P>The :nth-last-of-type() pseudo-class targets an element that has a certain number of siblings of the same element type <STRONG>after</STRONG> it in the document tree. Just like the :nth-last-child() pseudo-class, it starts counting from the last child instead of the first, and counts backwards. The following rule will match each second-to-last sibling of type p:</P>
<OL>
<LI>p:nth-last-of-type(2) { background:#ff0; } </LI></OL>
<P>The :nth-last-of-type() pseudo-class is currently not supported by any browsers.</P>
<H2>The :last-child pseudo-class</H2>
<P>The :last-child pseudo-class targets an element that is the last child of its parent element. It is the same as :nth-last-child(1). This rule will match all p elements that are the last child of their parent element:</P>
<OL>
<LI>p:last-child { background:#ff0; } </LI></OL>
<P>The :last-child pseudo-class works in browsers based on Mozilla. It is not supported by Opera and is buggy in Safari (the above rule matches all p elements in the document). Surprisingly it works as expected in OmniWeb (tested in version 5.1.1), despite that browser being based on Safari. That could be caused by a regression in the latest version of Apple WebKit, since OmniWeb is usually built on a slightly older version of WebKit than what Safari is using.</P>
<H2>The :first-of-type pseudo-class</H2>
<P>The :first-of-type pseudo-class targets an element that is the first sibling of its type. it is the same as :nth-of-type(1).</P>
<OL>
<LI>p:first-of-type { background:#ff0; } </LI></OL>
<P>The :first-of-type pseudo-class is currently not supported by any browsers.</P>
<H2>The :last-of-type pseudo-class</H2>
<P>The :last-of-type pseudo-class targets an element that is the last sibling of its type. it is the same as :nth-last-of-type(1).</P>
<OL>
<LI>p:last-of-type { background:#ff0; } </LI></OL>
<P>The :last-of-type pseudo-class is currently not supported by any browsers.</P>
<H2>The :only-child pseudo-class</H2>
<P>The :only-child pseudo-class targets an element whose parent element has no other element children. It is the same (but with a lower specificity) as :first-child:last-child or :nth-child(1):nth-last-child(1).</P>
<OL>
<LI>p:only-child { background:#ff0; } </LI></OL>
<P>The :only-child pseudo-class works in browsers based on Mozilla. Safari seems to interpret it as :first-child (the above rule matches all p elements in the document that are the first child of their parent element).</P>
<H2>The :only-of-type pseudo-class</H2>
<P>The :only-of-type pseudo-class targets an element whose parent element has no other children of the same element type. It is the same (but with a lower specificity) as :first-of-type:last-of-type or :nth-of-type(1):nth-last-of-type(1).</P>
<OL>
<LI>p:only-of-type { background:#ff0; } </LI></OL>
<P>The :only-of-type pseudo-class is currently not supported by any browsers.</P>
<H2>The :empty pseudo-class</H2>
<P>The :empty pseudo-class targets an element that has no children. That includes text nodes, so of the following elements, only the first is empty:</P>
<OL>
<LI>&lt;p&gt;&lt;/p&gt; </LI>
<LI>&lt;p&gt;Text&lt;/p&gt; </LI>
<LI>&lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt; </LI></OL>
<P>The following CSS rule will match that first element:</P>
<OL>
<LI>p:empty { background:#ff0; } </LI></OL>
<P>The :empty pseudo-class is currently supported by browsers based on Mozilla. Safari erroneously applies the rule to all elements of the given element type.</P>
<H2>The negation pseudo-class</H2>
<P>The negation pseudo-class, written :not(s), takes a simple selector as an argument. It targets elements that are not targeted by the simple selector. For example, the following CSS will target any element that is not a p element:</P>
<OL>
<LI>:not(p) { border:1px solid #ccc; } </LI></OL>
<P>The negation pseudo-class currently works in browsers based on Mozilla and Safari.</P>
<H2>The ::selection pseudo-element</H2>
<P>The ::selection pseudo-element matches the portion of an element that is currently selected or highlighted by the user. One possible use for this would be to control the appearance of selected text.</P>
<P>Only a few CSS properties apply to ::selection pseudo-elements: color, background, cursor, and outline.</P>
<P>The following rule will make the foreground colour of a selection red:</P>
<OL>
<LI>::selection { color:#f00; } </LI></OL>
<P>The ::selection pseudo-element currently only works in browsers based on Safari. The behaviour is a bit unpredictable, so the Safari implementation needs a bit of improvement. Mozilla based browsers support it if you use a -moz- prefix: ::-moz-selection. The prefix will probably be removed eventually.</P>
<H2>The General sibling combinator</H2>
<P>The general sibling combinator consists of two simple selectors separated by a “tilde” (~) character. It matches occurrences of elements matched by the second simple selector that are preceded by an element matched by the first simple selector. Both elements must have the same parent, but the second element does not have to be immediately preceded by the first element. This CSS rule will target ul elements that are preceded by a p element with the same parent:</P>
<OL>
<LI>p ~ ul { background:#ff0; } </LI></OL>
<P>The general sibling combinator is currently supported by Opera and browsers based on Mozilla.</P>]]></description>
<guid>http://www.cssdog.com/css3.html</guid><link>http://www.cssdog.com/css3.html</link><pubDate>Thu, 27 Nov 2008 18:21:40 +0600</pubDate></item>
		<item><title>cssdog useful resources</title><description><![CDATA[<DIV class=content2>
<H1>css_useful_resources</H1>
<DIV id=sitemap>
<UL>
<LI><A href="http://www.noupe.com/design/101-css-techniques-of-all-time-part-1.html" target=_blank>101 CSS Techniques- Part 1</A> </LI>
<LI><A href="http://www.forwebdesigners.com/" target=_blank>520 helpful links for webdesigners</A> </LI>
<LI><A href="http://www.smashingmagazine.com/2007/01/19/53-css-techniques-you-couldnt-live-without/" target=_blank>53 CSS-Techniques</A> </LI>
<LI><A href="http://www.phpletter.com/Our-Projects/AjaxFileUpload/" target=_blank>ajax file upload</A> </LI>
<LI><A href="http://www.alistapart.com/" target=_blank>alistapart</A> </LI>
<LI><A href="http://www.alvit.de/web-dev/" target=_blank>alvit.de</A> </LI>
<LI><A href="http://www.alvit.de/handbook/" target=_blank>alvit.de</A> </LI>
<LI><A href="http://bestwebgallery.com/" target=_blank>bestwebgallery</A> </LI>
<LI><A href="http://www.colorschemer.com/" target=_blank>colorschemer</A> </LI>
<LI><A href="http://livepipe.net/projects/control_tabs/" target=_blank>control tabs</A> </LI>
<LI><A href="http://www.webdesignerwall.com/tutorials/css-gradient-text-effect/" target=_blank>CSS gradient text effect</A> </LI>
<LI><A href="http://komodomedia.com/blog/index.php/2007/01/20/css-star-rating-redux/" target=_blank>css star rating</A> </LI>
<LI><A href="http://icant.co.uk/csstablegallery/index.php" target=_blank>css table gallery</A> </LI>
<LI><A href="http://css.maxdesign.com.au/" target=_blank>css.maxdesign</A> </LI>
<LI><A href="http://www.cssplay.co.uk/" target=_blank>cssplay</A> </LI>
<LI><A href="http://www.csszengarden.com/" target=_blank>csszengarden</A> </LI>
<LI><A href="http://www.devlisting.com/" target=_blank>devlisting</A> </LI>
<LI><A href="http://www.dezwozhere.com/links.html" target=_blank>dezwozhere - useful resource</A> </LI>
<LI><A href="http://http//www.dhtmlx.com" target=_blank>dhtmlx</A> </LI>
<LI><A href="http://intensivstation.ch/templates/" target=_blank>dynamische basis CSS templates</A> </LI>
<LI><A href="http://riddle.pl/emcalc/" target=_blank>emi calculator</A> </LI>
<LI><A href="http://momentumdesignlab.com/?ad=adWords_ui&amp;gclid=COebg4zumpECFQ4mewodaVC1ug" target=_blank>examples user interface design</A> </LI>
<LI><A href="http://www.smashingmagazine.com/category/css/" target=_blank>Expert Ideas For Better CSS</A> </LI>
<LI><A href="http://www.toxiclab.org/default.asp?ID=2" target=_blank>Flash tutorials 2 (118)</A> </LI>
<LI><A href="http://www.foundation-flash.com/tutorials/" target=_blank>Flash tutorials 2 Basic/Medium Tutorials with no code</A> </LI>
<LI><A href="http://www.free-css-templates.com/css-templates/11" target=_blank>free css templates</A> </LI>
<LI><A href="http://www.barelyfitz.com/projects/slideshow/index.php/1" target=_blank>JavaScript Slideshow</A> </LI>
<LI><A href="http://maps.google.com/" target=_blank>maps.google</A> </LI>
<LI><A href="http://devzone.zend.com/article/627-PHP-101-PHP-For-the-Absolute-Beginner" target=_blank>PHP For the Absolute Beginner</A> </LI>
<LI><A href="http://del.icio.us/popular/css" target=_blank>popular items</A> </LI>
<LI><A href="http://search.galaxyit.com/" target=_blank>search for topics,images,videos,news</A> </LI>
<LI><A href="http://snipplr.com/" target=_blank>snipplr</A> </LI>
<LI><A href="http://www.uie.com/articles/components_for_redesign/" target=_blank>successful web site redesign</A> </LI>
<LI><A href="http://www.tjkdesign.com/" target=_blank>tjkdesign</A> </LI>
<LI><A href="http://tonyyoo.com/v2/links.php" target=_blank>tonyyoo - web and code links</A> </LI>
<LI><A href="http://www.siolon.com/2007/tools-for-web-designers/" target=_blank>tools for web designers</A> </LI>
<LI><A href="http://www.digital-web.com/articles/web_2_for_designers/" target=_blank>web 2.0 for designers</A> </LI>
<LI><A href="http://www.barelyfitz.com/projects/encoder/" target=_blank>Web Data Encoder</A> </LI>
<LI><A href="http://www.mezzoblue.com/zengarden/alldesigns/" target=_blank>zen garden designs</A> </LI></UL></DIV><BR></DIV>
<DIV id=sitemap>&nbsp; 
<DIV class=h2 style="DISPLAY: block">Validators</DIV><BR>
<UL>
<LI><A href="http://www.htmlhelp.com/tools/csscheck/" target=_blank>css validator</A> </LI>
<LI><A href="http://browsershots.org/" target=_blank>Test your website in different browsers</A> </LI>
<LI><A href="http://www.tawdis.net/taw3/cms/en" target=_blank>analysis of web sites</A> </LI>
<LI><A href="http://jigsaw.w3.org/css-validator/" target=_blank>html with css validation</A> </LI>
<LI><A href="http://validator.w3.org/" target=_blank>html, xhtml w3c validators</A> </LI>
<LI><A href="http://infohound.net/tidy/" target=_blank>infohound - HTML tidy</A> </LI></UL></DIV>]]></description>
<guid>http://www.cssdog.com/css_useful_resources.html</guid>
<link>http://www.cssdog.com/css_useful_resources.html</link><pubDate>Wed, 26 Nov 2008 21:29:11 +0600</pubDate></item>
</channel>
</rss>
