<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Maze of Minds &#187; CSS</title>
	<atom:link href="/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>https://mazeofminds.com</link>
	<description>Blog About Web Design &#38; Development</description>
	<lastBuildDate>Thu, 30 Aug 2012 05:21:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>CSS3Ps &#8211; Free Cloud Based Photoshop Plugin</title>
		<link>https://mazeofminds.com/802/css3ps-free-cloud-based-photoshop-plugin/</link>
		<comments>https://mazeofminds.com/802/css3ps-free-cloud-based-photoshop-plugin/#comments</comments>
		<pubDate>Tue, 24 Jul 2012 18:07:58 +0000</pubDate>
		<dc:creator>Tomas</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Free]]></category>

		<guid isPermaLink="false">https://mazeofminds.com/?p=802</guid>
		<description><![CDATA[<p>Few days ago I found this Photoshop plugin. The interesting part about this plugin is that it lets you convert your Photoshop layers to pure CSS3. I just used it for few days and so far I am happy with the results. You can download it from website http://css3ps.com/ for free. It supports Photoshop CS5 and CS6 versions.</p> <p>Visit this link » </p>]]></description>
				<content:encoded><![CDATA[<div class="full-image"><a href="/802/css3ps-free-cloud-based-photoshop-plugin/"><img class="alignnone size-full wp-image-811" title="CSS3Ps" src="/wp-content/uploads/PS+CSS3.png" alt="PS+CSS3" width="460" height="220" /></a></div>
<p>Few days ago I found this Photoshop plugin. The interesting part about this plugin is that it lets you convert your Photoshop layers to pure CSS3. I just used it for few days and so far I am happy with the results. You can download it from website <a title="CSS3Ps" href="http://css3ps.com/">http://css3ps.com/</a> for free. It supports Photoshop CS5 and CS6 versions.</p>
<p><a class="download-btn" href="http://css3ps.com/">Visit this link »</a> </p>
]]></content:encoded>
			<wfw:commentRss>https://mazeofminds.com/802/css3ps-free-cloud-based-photoshop-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a Filterable Portfolio Powered by jQuery</title>
		<link>https://mazeofminds.com/533/filterable-portfolio-powered-by-jquery/</link>
		<comments>https://mazeofminds.com/533/filterable-portfolio-powered-by-jquery/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 18:16:11 +0000</pubDate>
		<dc:creator>Asta</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">https://mazeofminds.com/?p=533</guid>
		<description><![CDATA[<p>In this tutorial I will show you how to create a filterable portfolio using jQuery. The idea is to display all of your work in a single page that would have a filtering option allowing visitors to filter portfolio items by category. Limiting your portfolio to a single page helps to display all the portfolio items quickly and effectively and the filter makes it easy to navigate. </p> <p>To filter portfolio items we will use Quicksand plugin. Additionally, we will... <a href="/533/filterable-portfolio-powered-by-jquery/" title="Continue Reading the Post" class="read-more-link"> Read more<span class="read-more-prep">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div class="full-image"><img class="alignnone size-full wp-image-549" title="filterable-portfolio-0824" src="/wp-content/uploads/filterable-portfolio-0824.jpg" alt="Filterable Portfolio Powered by jQuery" width="460" height="220" /></div>
<p>In this tutorial I will show you how to create a filterable portfolio using jQuery. The idea is to display all of your work in a single page that would have a filtering option allowing visitors to filter portfolio items by category. Limiting your portfolio to a single page helps to display all the portfolio items quickly and effectively and the filter makes it easy to navigate. <span id="more-533"></span></p>
<p>To filter portfolio items we will use <a title="Quicksand plugin" href="http://razorjack.net/quicksand/">Quicksand plugin</a>. Additionally, we will need <a title="Easing plugin" href="http://gsgd.co.uk/sandbox/jquery/easing/">Easing Plugin</a> to give advanced easing options and <a title="PrettyPhoto plugin" href="http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/">PrettyPhoto plugin</a> to view full-size protfolio items.</p>
<p>The beautiful photos used in the demo are from the portfolio of fashion and beauty photographer <a title="Yulia Gorbachenko" href="http://www.yuliagorbachenko.com/">Yulia Gorbachenko</a>.</p>
<p><a class="download-btn" href="/wp-content/uploads/mofm-fp-source.zip">Source »</a> <a class="demo-btn" href="/demo/filterable-portfolio/">Demo »</a></p>
<h3>The Markup</h3>
<p>Say we have a number of photos in our portfolio and they can be classified in these categories: Beauty, Hannah, On Fire, Traction, Wavelength or Hair. Let&#8217;s create a category filter to navigate through our photos. A simple unordered list will perfectly work:</p>
<pre class="brush: xml; title: ; notranslate">&lt;ul class=&quot;filter&quot;&gt;
  &lt;li class=&quot;current all&quot;&gt;&lt;a href=&quot;#&quot;&gt;All&lt;/a&gt;&lt;/li&gt;
  &lt;li class=&quot;beauty&quot;&gt;&lt;a href=&quot;#&quot;&gt;Beauty&lt;/a&gt;&lt;/li&gt;
  &lt;li class=&quot;hannah&quot;&gt;&lt;a href=&quot;#&quot;&gt;Hannah&lt;/a&gt;&lt;/li&gt;
  &lt;li class=&quot;onfire&quot;&gt;&lt;a href=&quot;#&quot;&gt;On Fire&lt;/a&gt;&lt;/li&gt;
  &lt;li class=&quot;traction&quot;&gt;&lt;a href=&quot;#&quot;&gt;Traction&lt;/a&gt;&lt;/li&gt;
  &lt;li class=&quot;wavelength&quot;&gt;&lt;a href=&quot;#&quot;&gt;Wavelength&lt;/a&gt;&lt;/li&gt;
  &lt;li class=&quot;hair&quot;&gt;&lt;a href=&quot;#&quot;&gt;Hair&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<p>We assign classes equal to the category name to each list item for later use in jQuery. Additionally, we add one more list item &#8220;All&#8221; to view all portfolio items. We also assign the class <code>"current"</code> to this item because we want to show all portfolio items in the default view.</p>
<p>Now when we have our filter let&#8217;s move on and create one more list to hold our portfolio items:</p>
<pre class="brush: xml; title: ; notranslate">&lt;ul class=&quot;portfolio&quot;&gt;
  &lt;li data-id=&quot;id-1&quot; data-type=&quot;hannah&quot;&gt;
    &lt;a href=&quot;images/hannah_yg.jpg&quot; rel=&quot;prettyPhoto[portfolio]&quot;&gt;
      &lt;img src=&quot;images/hannah_yg_thumb.jpg&quot; /&gt;
    &lt;/a&gt;
  &lt;/li&gt;
  &lt;li data-id=&quot;id-2&quot; data-type=&quot;hair&quot;&gt;
    &lt;a href=&quot;images/bianca_yg.jpg&quot; rel=&quot;prettyPhoto[portfolio]&quot;&gt;
      &lt;img src=&quot;images/bianca_yg_thumb.jpg&quot; /&gt;
    &lt;/a&gt;
  &lt;/li&gt;
  &lt;li data-id=&quot;id-3&quot; data-type=&quot;traction&quot;&gt;
    &lt;a href=&quot;images/heather_yg.jpg&quot; rel=&quot;prettyPhoto[portfolio]&quot;&gt;
      &lt;img src=&quot;images/heather_yg_thumb.jpg&quot; /&gt;
    &lt;/a&gt;
  &lt;/li&gt;
  ...
&lt;/ul&gt;</pre>
<p>Each list item contains the thumbnail image with an anchor tag around it. The anchor&#8217;s <code>href</code> attribute defines the URL of the full-size image and the <code>rel</code> attribute is necessary for the PrettyPhoto plugin that we will use later.</p>
<p>You may have also noticed that every list item has <code>data-id</code> and <code>data-type</code> attributes. Both are necessary for the Quicksand plugin. <code>data-id</code> is a unique identifier and <code>data-type</code> defines the category to which the portfolio item is assigned. Note that <code>data-*</code> is a perfectly valid HTML5 attribute.</p>
<h3>The CSS</h3>
<p>This isn&#8217;t a tutorial on CSS, so I won&#8217;t go into great detail about how to style the gallery. You can see my stylesheet in the source files attached to this post. I would just like to note that I have used several selectors and properties that are not supported in the earlier versions of IE.</p>
<h3>The jQuery</h3>
<p>First, we include the latest version of jQuery library and necessary plugins in the head of our document. For the prettyPhoto plugin we also need to include prettyPhoto stylesheet that comes with the plugin:</p>
<pre class="brush: xml; title: ; notranslate">&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;css/prettyPhoto.css&quot;/&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery-1.6.2.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery.quicksand.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery.prettyPhoto.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery.easing.1.3.js&quot;&gt;&lt;/script&gt;</pre>
<p>Next, when the document is loaded we initialize the prettyPhoto plugin. The prettyPhoto plugin accepts a number of parameters so you can easily customize it:</p>
<pre class="brush: jscript; title: ; notranslate">$(document).ready(function(){
  $(&quot;.portfolio a[rel^='prettyPhoto']&quot;).prettyPhoto({
    theme:'light_square',
    autoplay_slideshow: false,
    overlay_gallery: false
  });</pre>
<p>Then we add some code to handle the Quicksand plugin:</p>
<pre class="brush: jscript; title: ; notranslate">var $portfolioClone = $(&quot;.portfolio&quot;).clone();
$(&quot;.filter a&quot;).click(function(e){
  $(&quot;.filter li&quot;).removeClass(&quot;current&quot;);
  var $filterClass = $(this).parent().attr(&quot;class&quot;);
  if ($filterClass == &quot;all&quot;) {
    var $filteredPortfolio = $portfolioClone.find(&quot;li&quot;);
  } else {
    var $filteredPortfolio = $portfolioClone.find(&quot;li[data-type~=&quot;+$filterClass+&quot;]&quot;);
  }</pre>
<p>Quicksand works by comparing two collections of items and replacing them with a nice shuffling animation. By appending <code>.clone()</code> to our portfolio list and assigning it to <code>$portfolioClone</code>, we get a copy of the original list items that we will use later.<br />
Once the link in the category filter is clicked, we want to remove the class <code>current</code> from the list item that has it and to determine which link has been clicked by taking the class value and assigning it to the <code>$filterClass</code>. In the case if the &#8220;All&#8221; link has been clicked, we want to show all of the portfolio items. Otherwise, we want to show only those list items that have <code>data-type</code> attribute with a value containing <code>$filterClass</code>.</p>
<pre class="brush: jscript; title: ; notranslate">    $(&quot;.portfolio&quot;).quicksand( $filteredPortfolio, {
      duration: 800,
      easing: 'easeInOutQuad'
    }, function(){
      $(&quot;.portfolio a[rel^='prettyPhoto']&quot;).prettyPhoto({
        theme:'light_square',
        autoplay_slideshow: false,
        overlay_gallery: false
      });
    });
    $(this).parent().addClass(&quot;current&quot;);
    e.preventDefault();
  })
});</pre>
<p>Finally, we call <code>quicksand</code>. <code>$filteredPortfolio</code> which was assigned in the if statement contains filtered portfolio items that are to be displayed instead of the original portfolio items. We can also specify how long the animation will take, the easing type for the animation (don&#8217;t forget to include <a title="Easing plugin" href="http://gsgd.co.uk/sandbox/jquery/easing/">jQuery Easing Plugin</a> for this) and other optional parameters. As the last argument we include a callback function to apply prettyPhoto on newly cloned portfolio items as well.</p>
<p>In the last lines of code we add the class <code>current</code> to the parent of the clicked link and call <code>preventDefault()</code> to prevent the browser jump to the link anchor.</p>
<p>With that our filterable portfolio is finished. I hope you enjoyed the tutorial and find it useful! I tried to explain everything as best as I can and if you have any questions, please feel free to ask.</p>
<p><a title="Twitter" href="http://twitter.com/MazeofMinds">Follow us on Twitter</a>, or <a class="rss" title="Subscribe to Articles Feed" href="http://feeds.feedburner.com/MazeOfMinds">subscribe to RSS Feed</a> for more tutorials and posts.</p>
]]></content:encoded>
			<wfw:commentRss>https://mazeofminds.com/533/filterable-portfolio-powered-by-jquery/feed/</wfw:commentRss>
		<slash:comments>92</slash:comments>
		</item>
		<item>
		<title>CSS Selectors Overview, Part 2</title>
		<link>https://mazeofminds.com/374/css-selectors-overview-part-2/</link>
		<comments>https://mazeofminds.com/374/css-selectors-overview-part-2/#comments</comments>
		<pubDate>Tue, 09 Aug 2011 18:48:06 +0000</pubDate>
		<dc:creator>Asta</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">https://mazeofminds.com/?p=374</guid>
		<description><![CDATA[<p>It is the second part of the post dedicated to CSS selectors. In Part 1 I explained the most common and simple selectors like type, ID, class and universal, as well as attribute selectors. In this part I will take a closer look at combinators, pseudo-classes and pseudo-elements.</p> Combinators <p>While previously described selectors select an element based on an element type or its attributes, combinator selectors allow you to select an element based on its relationship to other elements on... <a href="/374/css-selectors-overview-part-2/" title="Continue Reading the Post" class="read-more-link"> Read more<span class="read-more-prep">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div class="full-image"><img src="/wp-content/uploads/CSS_Selectors_part_2.png" alt="CSS Selectors Overview, Part 2" title="CSS_Selectors_part_2" width="460" height="220" class="alignnone size-full wp-image-420" /></div>
<p>It is the second part of the post dedicated to CSS selectors. In  <a href="/305/css-selectors-overview-part-1/" title="CSS Selectors Overview, Part 1">Part 1</a> I explained the most common and simple selectors like type, ID, class and universal, as well as attribute selectors. In this part I will take a closer look at combinators, pseudo-classes and pseudo-elements.<span id="more-374"></span></p>
<h3>Combinators</h3>
<p>While previously described selectors select an element based on an element type or its attributes, combinator selectors allow you to select an element based on its relationship to other elements on the page. The most important relationships are:</p>
<ul>
<li><strong>Ancestor</strong>. An element that wraps another element is its ancestor.</li>
<li><strong>Descendant</strong>. An element inside one or more elements is a descendant.</li>
<li><strong>Parent</strong>. A parent element is the closest ancestor of another element.</li>
<li><strong>Child</strong>. An element that is directly enclosed by another element is a child. Second generation and higher element is sometimes referred to as grandchild.</li>
<li><strong>Sibling</strong>. Two elements in the same parent are called siblings, and two elements immediately next to each other are adjacent siblings.</li>
</ul>
<p>Ok, let&#8217;s take a closer look at each of the combinator selectors.</p>
<h4>Descendant Selector</h4>
<p>Represented by whitespace, descendant selector allows you to create style rules that are effective only when an element is the descendant of another one. The number of elements between the ancestor and descendant doesn&#8217;t matter. Consider the following example:</p>
<pre class="brush: xml; title: ; notranslate">&lt;ul id=&quot;main-nav&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;&quot;&gt;Page Link 1&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;&quot;&gt;Page Link 2&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;&quot;&gt;Sub-page Link 1&lt;/a&gt;&lt;/li&gt;	
      &lt;li&gt;&lt;a href=&quot;&quot;&gt;Sub-page Link 2&lt;/a&gt;&lt;/li&gt;	
    &lt;/ul&gt;
  &lt;/li&gt;	
  &lt;li&gt;&lt;a href=&quot;&quot;&gt;Page Link 3&lt;/a&gt;&lt;/li&gt;	
&lt;/ul&gt;</pre>
<p>The following rule matches all five <code>li</code> elements because each of them has element with an ID equal to <code>main-nav</code> as its ancestor:</p>
<pre class="brush: css; title: ; notranslate">#main-nav li { 
  background: url(icon.gif) no-repeat left top; 
  padding-left: 20px;
}</pre>
<p>Compatibility: IE 6+, Firefox, Chrome, Safari, Opera.</p>
<h4>Child Selector</h4>
<p>Child selectors are similar to descendant selectors, but they select only children rather than all descendants. The combinator in a child selector is a greater-than sign (>). For example, if you applied the following CSS rule to the previous HTML fragment, only the list items in the outer list would be given an icon and padding, while list items with the links to sub-pages will remain unaffected:</p>
<pre class="brush: css; title: ; notranslate">#main-nav &gt; li { 
  background: url(icon.gif) no-repeat left top; 
  padding-left: 20px;
}</pre>
<p>Compatibility: IE 7+, Firefox, Chrome, Safari, Opera.</p>
<h4>Adjacent Sibling Selector</h4>
<p>An adjacent sibling selector uses a plus sign &#8220;+&#8221; and matches the element that is the immediatelly following sibling of a given element. Consider the following markup:</p>
<pre class="brush: xml; title: ; notranslate">&lt;article&gt;
  &lt;h1&gt;Article Title&lt;/h1&gt;	
  &lt;p&gt;Some text...&lt;/p&gt;	
  &lt;p&gt;Some text...&lt;/p&gt;	
&lt;/article&gt;</pre>
<p>Say you want to give the first paragraph after each heading different formatting from the paragraphs that follow. The following adjacent sibling selector can help you achieve this:</p>
<pre class="brush: css; title: ; notranslate">h1 + p { color: #666; font-style: italic; }</pre>
<p>Compatibility: IE 7+, Firefox, Chrome, Safari, Opera.</p>
<h4>General Sibling Selector</h4>
<p>A general sibling selector is less strict. It matches elements that are siblings of a given element but elements do not have to appear immediately one after another. The combinator in this selector is a tilde sign (~).</p>
<pre class="brush: css; title: ; notranslate">h1 ~ p { color: #666; font-style: italic; }</pre>
<p>If we applied the above CSS rule to the previous example both <code>p</code> elements would match the sibling selector <code>h1 ~ p</code> because both <code>p</code> elements are siblings to <code>h1</code> element.</p>
<p>Compatibility: IE 7+, Firefox, Chrome, Safari, Opera.</p>
<h3>Pseudo-Classes</h3>
<p>A pseudo-class provides a way to select an element based on information that is not specified in the document tree. It always consists of a colon (:) followed by the name of the pseudo-class. No whitespace may appear before or after the colon.</p>
<h4>The :link and :visited pseudo-classes</h4>
<p>These two pseudo-classes represent the state of links. When unvisited as determined by the browser and its document history, a link can be selected with the <code>:link</code> pseudo-class, or when visited, it can be selected using the <code>:visited</code> pseudo-class. For example:</p>
<pre class="brush: css; title: ; notranslate">:link { color: #00f; }
:visited { color: #999; }</pre>
<p><code>:link</code> and <code>:visited</code> are mutually exclusive, that is they cannot be applied simultaneously to the same element. It should also be noted that browsers may treat all links as unvisited, or implement other measures to preserve the user&#8217;s privacy.</p>
<p>Compatibility: IE, Firefox, Chrome, Safari, Opera.</p>
<h4>The :hover, :active and :focus pseudo-classes</h4>
<p>These three can be used to style elements in response to user actions: <code>:hover</code> is applied when the user&#8217;s pointing device is over an element; <code>:active</code> is applied when an element is being activated by the user; <code>:focus</code> is applied when an element gains focus. For example, let&#8217;s style the states of an input element:</p>
<pre class="brush: css; title: ; notranslate">input { border:1px solid #999; color:#999; padding:3px; }
input:hover { border-color:#c99; color:#666; }
input:focus { border-color:#f00; color:#000; }
input:active { border-color:#f00; color:#f00; }</pre>
<p>Compatibility: IE 6+ (<code>:focus</code> in IE 9+), Firefox, Chrome, Safari, Opera.</p>
<h4>The :target pseudo-class</h4>
<p>URIs with fragment identifiers (represented by the caharacter # followed by an anchor name or element ID) link to a certain element within the document, known as the target element. The <code>:target</code> pseudo-class selects the target element and lets you style it. Consider the following HTML fragment:</p>
<pre class="brush: xml; title: ; notranslate">&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#section1&quot;&gt;Section 1&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#section2&quot;&gt;Section 2&lt;/a&gt;&lt;/li&gt;
  ...
&lt;/ul&gt;
&lt;div id=&quot;section1&quot;&gt;
  &lt;p&gt;Some text...&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&quot;section2&quot;&gt;
  &lt;p&gt;Some text...&lt;/p&gt;
&lt;/div&gt;
...</pre>
<p>Using the <code>:target</code> pseudo-class, you can easily highlight the section that the user wants to read:</p>
<pre class="brush: css; title: ; notranslate">div:target { border: 1px solid #ccc; background-color: #eee; }</pre>
<p>Compatibility: IE 9+, Firefox, Chrome, Safari, Opera.</p>
<h4>The :lang pseudo-class</h4>
<p>The language pseudo-class allows you to style elements whose content is defined to be in a certain language. For example, <code>article:lang(es)</code> selects an article element in Spanish.</p>
<p>Compatibility: IE 8+, Firefox, Chrome, Safari, Opera.</p>
<h4>The :not(X) pseudo-class</h4>
<p>The negation pseudo-class <code>:not(X)</code> selects all elements except those that are given as the value of an argument (X). For example, the following rule matches all input elements except those with a <code>type</code> value of <code>"email"</code>:</p>
<pre class="brush: css; title: ; notranslate">input:not([type=&quot;email&quot;]) { border: 1px solid #999; }</pre>
<p>Compatibility: IE 9+, Firefox, Chrome, Safari, Opera.</p>
<h4>The :root pseudo-class</h4>
<p>The :root pseudo-class applies one or more styles to the element that is the root element of the document. For HTML documents, this is always the html element.</p>
<p>Compatibility: IE 9+, Firefox, Chrome, Safari, Opera.</p>
<h4>The :nth-child and :nth-of-type pseudo classes</h4>
<p>The <code>:nth-child(an+b)</code> pseudo class selects elements that appear at a specific position within the list of its parent’s children. The position is defined via the pattern <code>an+b</code>, where you replace <code>a</code> and <code>b</code> by integer numbers (positive, negative, or zero) of your choice, and <code>n</code> is a counter starting at 0. The position can also be specified using keywords &#8220;even&#8221; (same as <code>2n</code>) and &#8220;odd&#8221; (same as <code>2n+1</code>).</p>
<p><code>:nth-of-type</code> works exactly like the <code>:nth-child</code> pseudo-class, except that it only considers child elements of the specified type.</p>
<p>Take a look at these two rules:</p>
<pre class="brush: css; title: ; notranslate">article :nth-child(3n+1) { color: #999; }
article p:nth-of-type(even) { color: #999; }</pre>
<p>Since <code>n</code> starts at 0 and increases by 1 each cycle, the first rule matches the 1st, 4th, 7th, and so on, child elements in an <code>article</code> element. And the second rule matches only even-numbered paragraphs in an <code>article</code> element.</p>
<p>Compatibility: IE 9+, Firefox 3.5+, Chrome, Safari.</p>
<h4>The :nth-last-child and :nth-last-of-type pseudo classes</h4>
<p>These two pseudo-classes accept the same arguments as <code>:nth-child</code> and <code>:nth-of-type</code>, except they are counted from the last element, working in reverse. Here is an example:</p>
<pre class="brush: css; title: ; notranslate">tr:nth-last-of-type(-n+2) { font-style: bold; }</pre>
<p>The count starts at the last <code>tr</code> element in the table and counts up in reverse order, so the rule is applied to the last two rows in the table.</p>
<p>Compatibility: IE 9+, Firefox 3.5+, Chrome, Safari, Opera.</p>
<h4>The :first-child and :last-child pseudo-classes</h4>
<p>The <code>:first-child</code> and <code>:last-child</code> pseudo-class selectors represent the first and last children elements of some other element. They are equivalent to <code>:nth-child(1)</code> and <code>:nth-last-child(1)</code>, respectively.</p>
<p>Compatibility: IE 7+ (<code>:last-child</code> since IE 9+), Firefox, Chrome, Safari, Opera.</p>
<h4>The :first-of-type and :last-of-type pseudo-classes</h4>
<p>The <code>:first-of-type</code> and <code>:last-of-type</code> pseudo-class selectors represent the first and last children elements of the specified element type. They are equivalent to <code>:nth-of-type(1)</code> and <code>:nth-last-of-type(1)</code>, respectively.</p>
<p>Compatibility: IE 9+, Firefox 3.5+, Chrome, Safari, Opera.</p>
<h4>The :only-child pseudo-class</h4>
<p>This pseudo-class selects an element that has no siblings, i.e. it is the only child of its parent element. Any element selected by <code>:only-child</code> matches both the <code>:first-child</code> and <code>:last-child</code> selectors.</p>
<p>Compatibility: IE 9+, Firefox, Chrome, Safari, Opera.</p>
<h4>The :only-of-type pseudo-class</h4>
<p>The <code>:only-of-type</code> pseudo-class matches an element that has no siblings with the same element name. So it matches both the <code>:first-of-type</code> and <code>:last-of-type</code> selectors as well.</p>
<p>Compatibility: IE 9+, Firefox 3.5+, Chrome, Safari, Opera.</p>
<h4>The :empty pseudo-class</h4>
<p>The <code>:empty</code> pseudo-class targets an element that has no children, including text nodes. Comments and processing instructions don’t count as children. So the selector <code>td:empty</code> will match only the first <code>td</code> element in the following markup, as the other two contain a text node and a child element:</p>
<pre class="brush: xml; title: ; notranslate">&lt;tr&gt;
  &lt;td&gt;&lt;/td&gt;
  &lt;td&gt;Some text...&lt;/td&gt;
  &lt;td&gt;&lt;em&gt;&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;</pre>
<p>Compatibility: IE 9+, Firefox, Chrome, Safari, Opera.</p>
<h4>The :enabled, :disabled and :checked pseudo-classes</h4>
<p>These pseudo-classes are used to select user interface (UI) elements based on their current state. The <code>:enabled</code> pseudo-class represents UI elements that are in an enabled state, while <code>:disabled</code> represents UI elements that are in a disabled state. The following rules will apply different borders to text input elements depending on whether they are enabled or disabled:</p>
<pre class="brush: css; title: ; notranslate">input[type=&quot;text&quot;]:disabled { border: 1px dotted #999; }
input[type=&quot;text&quot;]:enabled { border: 1px solid #000; }</pre>
<p>The <code>:checked</code> pseudo-class select UI elements (form controls such as radio buttons, check boxes) that are checked or toggled to the &#8220;on&#8221; state. For example:</p>
<pre class="brush: css; title: ; notranslate">input:checked {outline: 1px solid #f00;}</pre>
<p>Compatibility: IE 9+, Firefox, Chrome, Safari, Opera.</p>
<h3>Pseudo-Elements</h3>
<p>Pseudo-elements target pieces of HTML that do not exist as standalone elements in the document tree. For example, you can use the <code>first-letter</code> pseudo-element to format the first letter of a paragraph differently, even though that first letter doesn’t have HTML tags wrapped around it.</p>
<p>CSS1 and CSS2 defined pseudo-elements with a single colon (:). To better distinguish pseudo-elements from pseudo-classes, in CSS3 pseudo-elements start with a double colon (::). However, to remain compatible most browsers (except IE7 and IE8) support both versions.</p>
<h4>:first-letter pseudo-element</h4>
<p>This pseudo-element targets the first letter (or digit) of a block-like elements such as block, inline-block, list-item, table-cell and table-caption. Here is a simple code fragment:</p>
<pre class="brush: xml; title: ; notranslate">&lt;article&gt;
  &lt;h1&gt;Article Title&lt;/h1&gt;	
  &lt;p&gt;Some text...&lt;/p&gt;	
  &lt;p&gt;Some text...&lt;/p&gt;	
&lt;/article&gt;</pre>
<p>The following selector allows you to style the first letter of each paragraph:</p>
<pre class="brush: css; title: ; notranslate">article p:first-letter { font-weight: bold; color: #f00;}</pre>
<p>You can also use pseudo-class together with pseudo-element to style only the first paragraph in an article:</p>
<pre class="brush: css; title: ; notranslate">article p:first-of-type:first-letter { font-weight: bold; color: #f00;}</pre>
<p>Compatibility: IE 6+, Firefox, Chrome, Safari, Opera.</p>
<h4>:first-line pseudo-element</h4>
<p>The <code>:first-line</code> pseudo-element selects the first line of a block-like element such as block, inline-block, table-caption or table-cell. The length of the first line depends on a number of factors, including the width of the the element containing the text, the font size, etc.</p>
<p>The following selector will match the first line of every <code>p</code> element in the previous example:</p>
<pre class="brush: css; title: ; notranslate">article p:first-line { text-transform: uppercase; }</pre>
<p>Compatibility: IE 6+, Firefox, Chrome, Safari, Opera.</p>
<h4>:before and :after pseudo-elements</h4>
<p>The <code>:before</code> and <code>:after</code> pseudo-elements can be used to insert generated content before or after an element&#8217;s content. This content inherits properties from the element in the document tree to which they are attached. For example, say you want to add &#8220;Important!&#8221; before paragraphs with a class &#8220;<code>important</code>&#8221; to make them standout. You can do this using <code>:before</code> pseudo-element like this:</p>
<pre class="brush: css; title: ; notranslate">.important:before { content: &quot;Important! &quot;; color: #f00; }</pre>
<p>If you decide to change your special message from &#8220;Important!&#8221; to, let&#8217;s say, &#8220;Note.&#8221;, then you can change every page on your site with one quick change in your style sheet. However, if the browser doesn&#8217;t support this pseudo-element, your special message will be invisible.</p>
<p>It also should be noted that the content generated using <code>:before</code> and <code>:after</code> pseudo-elements will not appear to search engines or screen readers, so you shouldn&#8217;t rely on it for anything vital.</p>
<p>Compatibility: IE 8+, Firefox, Chrome, Safari, Opera.</p>
<h4>::selection pseudo-element</h4>
<p>This CSS3 pseudo-element applies to the part of a document that has been highlighted by the user. For example, the following rule makes any selected text white on black background:</p>
<pre class="brush: css; title: ; notranslate">::selection { color: #fff; background-color: #000; }</pre>
<p>The <code>::selection</code> pseudo-element was removed from the current CSS3 draft.</p>
<p>This last selector ends up my overview of CSS selectors. Thanks for reading, and I hope you&#8217;ve found some helpful tips!</p>
]]></content:encoded>
			<wfw:commentRss>https://mazeofminds.com/374/css-selectors-overview-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CSS Selectors Overview, Part 1</title>
		<link>https://mazeofminds.com/305/css-selectors-overview-part-1/</link>
		<comments>https://mazeofminds.com/305/css-selectors-overview-part-1/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 08:55:53 +0000</pubDate>
		<dc:creator>Asta</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">https://mazeofminds.com/?p=305</guid>
		<description><![CDATA[<p>Every CSS rule has two basic parts: a selector and a declaration block. The declaration block lists the formatting instructions like font size, line height, borders, and so on. However, the fundamental part of CSS rule is the selector &#8211; after all it tells a web browser to which element or elements on a page these formatting instructions should be applied. Although the original CSS1 specification had only 5 or 6, CSS2 and CSS3 introduced a variety of new selectors... <a href="/305/css-selectors-overview-part-1/" title="Continue Reading the Post" class="read-more-link"> Read more<span class="read-more-prep">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div class="full-image"><img src="/wp-content/uploads/CSS_Selectors_part_1.jpg" alt="CSS Selectors, Part 1" title="CSS_Selectors_part_1" width="460" height="220" class="alignnone size-full wp-image-322" /></div>
<p>Every CSS rule has two basic parts: a selector and a declaration block. The declaration block lists the formatting instructions like font size, line height, borders, and so on. However, the fundamental part of CSS rule is the selector &#8211; after all it tells a web browser to which element or elements on a page these formatting instructions should be applied. Although the original CSS1 specification had only 5 or 6, CSS2 and CSS3 introduced a variety of new selectors enabling complex styling of webpages using simpler CSS and less script. So let&#8217;s explore available CSS selectors starting with the most common and simplest and moving onto the more advanced ones.<span id="more-305"></span></p>
<h3>Universal Selector</h3>
<p>The universal selector, denoted by an asterisk, matches any element type in the document. For example, the following rule will reset the default browser padding and margin on every element:</p>
<pre class="brush: css; title: ; notranslate">* { margin: 0; padding: 0; }</pre>
<p>Universal selector can be used not only as a stand alone selector but as part of a descendent selector as well. So you can apply a style to all of the tags that descend from a particular element. For example, consider the following HTML fragment:</p>
<pre class="brush: xml; title: ; notranslate">&lt;article&gt;
  &lt;header&gt;
    &lt;h1&gt;Article Title&lt;/h1&gt;
    &lt;p&gt;By Author&lt;/p&gt;
  &lt;/header&gt;
  &lt;p&gt;Some text...&lt;/p&gt;
&lt;/article&gt;</pre>
<p>To draw a thin gray border around every element inside <code>article</code> tag you could use the following rule:</p>
<pre class="brush: css; title: ; notranslate">article * { border: 1px solid #555; }</pre>
<p>Despite the power and flexibility of the universal selector developers are discouraged from using it as it&#8217;s the most expensive CSS selector in terms of webpage performance.</p>
<p>Compatibility: IE 7+, Firefox, Chrome, Safari, Opera.</p>
<h3>Type Selectors</h3>
<p>If you&#8217;ve written even a single rule in a style sheet, you&#8217;ve used a type selector. It selects all elements of the specified element type. For example, <code>ul</code>, <code>p</code> and <code>a</code> are all element selectors and the following CSS rules will be applied respectively to all <code>ul</code>, <code>p</code> and <code>a</code> elements within the page:</p>
<pre class="brush: css; title: ; notranslate">ul { list-style-type: circle; margin-bottom: 18px; }
p { margin-bottom: 18px; }
a { color: #369; text-decoration: none; }</pre>
<p>Compatibility: IE 6+, Firefox, Chrome, Safari, Opera.</p>
<h3>Class Selector</h3>
<p>CSS class selector matches elements based on the contents of their <code>class</code> attribute. Consider the following HTML fragment:</p>
<pre class="brush: xml; title: ; notranslate">&lt;article&gt;
  &lt;header&gt;
    &lt;h1&gt;Article Title&lt;/h1&gt;
    &lt;p class=&quot;byline&quot;&gt;By John Doe&lt;/p&gt;
  &lt;/header&gt;
  &lt;p&gt;Some text...&lt;/p&gt;
&lt;/article&gt;</pre>
<p>Say you want to format the <code>p</code> element containing author information but you don’t want all <code>p</code> elements affected. In this case you can use a class selector:</p>
<pre class="brush: css; title: ; notranslate">.byline { color: #999; font-size: 11px; }</pre>
<p>This selector is equivalent to <code>*.byline</code> and matches all elements with a <code>class</code> attribute that contains the value &#8220;byline&#8221;. However, you can create dependent classes which tie the declaration of the class to a particular element by placing a type selector in front of the class. For example, the following CSS rule will be applied only to <code>p</code> elements with a <code>class</code> attribute that contains the value &#8220;byline&#8221;:</p>
<pre class="brush: css; title: ; notranslate">p.byline { color: #999; font-size: 11px; }</pre>
<p>You can assign multiple classes to a single element by adding additional class names in a space-separated list. Class selectors can then be used to target only elements which have several class names. For example, the following style rule matches any <code>p</code> element if its <code>class</code> attribute has a space-separated list of values that include both the &#8220;byline&#8221; and &#8220;johndoe&#8221; class names:</p>
<pre class="brush: css; title: ; notranslate">p.byline.johndoe { color: #369; }</pre>
<p>Compatibility: IE 6+, Firefox, Chrome, Safari, Opera. <em>(Prior to IE 7 multiple classes are not supported.)</em></p>
<h3>ID Selector</h3>
<p>ID selector matches an element based on the contents of that element&#8217;s ID attribute. Unlike classes, an ID can only be used once per page, and is a unique identifier to an element. Therefore IDs should be reserved for unique, single-use elements. Here is a simple example:</p>
<pre class="brush: xml; title: ; notranslate">&lt;div id=&quot;page-wrap&quot;&gt;
  ...
&lt;/div&gt;</pre>
<p>And the ID selector for this element:</p>
<pre class="brush: css; title: ; notranslate">#page-wrap { width: 960px; margin: 0 auto; }</pre>
<p>As with classes you can also create dependent ids, which use the declarations of the id only when applied to a particular element. However, it&#8217;s rarely necessary because the point of id is that you use it only once per page.</p>
<p>Compatibility: IE 6+, Firefox, Chrome, Safari, Opera.</p>
<h3>Attribute selectors</h3>
<p>As you may expect from the name, an attribute selector allows you to style an element based on the existence of an attribute or the attribute’s value. Four attribute selectors were introduced in CSS2, and CSS3 added three additional attribute selectors for matching substrings in the value of an attribute.</p>
<h4>[attr] &#8211; attribute existence</h4>
<p>This type of attribute selector matches elements with the specified attribute, regardless of the attribute’s value. The example below selects html5 input elements that have the <code>required</code> attribute:</p>
<pre class="brush: css; title: ; notranslate">input[required] { border: 1px solid #f00; }</pre>
<p>Compatibility: IE 7+, Firefox, Chrome, Safari, Opera.</p>
<h4>[attr="value"] &#8211; exact value</h4>
<p>You can select elements that not only share a particular attribute but also have an exact value set for that attribute. For example:</p>
<pre class="brush: css; title: ; notranslate">input[type=&quot;text&quot;] { padding: 3px; }</pre>
<p>This selector matches any input element that has a <code>type</code> attribute with a value equal to <code>text</code>.</p>
<p>Compatibility: IE 7+, Firefox, Chrome, Safari, Opera.</p>
<h4>[attr~="value"] &#8211; spaced list</h4>
<p>The ~= operator allows you to target an element if it has the specified attribute that contains a list of space-separated words, one of which is the specified value. Let&#8217;s make things clearer. Say you want to give a border to images with <code>alt</code> text &#8220;Figure 1&#8243;, &#8220;Figure 2&#8243; and &#8220;Figure 3&#8243;. You can select all these images with the following selector:</p>
<pre class="brush: css; title: ; notranslate">img[alt~=&quot;Figure&quot;] { border: 1px double #999; }</pre>
<p>Compatibility: IE 7+, Firefox, Chrome, Safari, Opera.</p>
<h4>[attr|="value"] &#8211; hyphenated list</h4>
<p>This attribute selector matches elements with the specified attribute that contains a list of hyphen-separated words, one of which is the specified value. Generally used for language subcode matches:</p>
<pre class="brush: css; title: ; notranslate">p[lang|=&quot;en&quot;] { color: #f00; }</pre>
<p>This matches all p elements with <code>lang</code> attribute <code>en</code>, <code>en-gb</code>, <code>en-us</code>.</p>
<p>Compatibility: IE 7+, Firefox, Chrome, Safari, Opera.</p>
<h4>[attr^="value"] &#8211; begins with</h4>
<p>Added in CSS3 this attribute selector lets you select elements with an attribute value that begins with the specified value. Suppose you want to style all external links differently. Assuming you don’t use absolute links for internal links and any external link begins with <code>http://</code> you can create the following attribute selector:</p>
<pre class="brush: css; title: ; notranslate">a[href^=&quot;http://&quot;] { color: #f00; }</pre>
<p>Compatibility: IE 7+, Firefox, Chrome, Safari, Opera.</p>
<h4>[attr$="value"] &#8211; ends with</h4>
<p>This one matches elements with an attribute value that ends with the specified value. Also added in CSS3. For example, say you want to style all links that point to a ZIP archive file differently. To target them you can simply use:</p>
<pre class="brush: css; title: ; notranslate">a[href$=&quot;.zip&quot;] { color: #00f; }</pre>
<p>Compatibility: IE 7+, Firefox, Chrome, Safari, Opera.</p>
<h4>[attr*="value"] &#8211; contains</h4>
<p>And finally, the last attribute selector. Also added in CSS3. It matches elements that have an attribute which contains the specified value anywhere within it. This example will match <code>img</code> elements with an <code>src</code> attribute that contains the string <code>"thumb"</code>:</p>
<pre class="brush: css; title: ; notranslate">img[src*=&quot;thumb&quot;] { border: 1px solid #333; }</pre>
<p>So, images named &#8220;sunset_thumb.jpg&#8221; or &#8220;sunrise_thumb.jpg&#8221; will be styled.</p>
<p>Compatibility: IE 7+, Firefox, Chrome, Safari, Opera.</p>
<p>CSS doesn’t limit attribute selectors to tag names &#8211; you can combine them with classes, too. For example, <code>.thumbnail[title]</code> selects every element with the <code>thumbnail</code> class and <code>title</code> attribute. </p>
<p>Multiple attribute selectors can also be used to represent several attributes of an element. For example, <code>input[type="email"][required]</code> selects every input element that has <code>type</code> attribute equal to <code>email</code> and a <code>required</code> attribute regardless of its value.</p>
<h3>To be Continued&#8230;</h3>
<p>This is the end of Part 1. In the second and final part I will cover combinators, pseudo-classes and pseudo-elements.</p>
]]></content:encoded>
			<wfw:commentRss>https://mazeofminds.com/305/css-selectors-overview-part-1/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to Change Text Selection Color Using CSS3</title>
		<link>https://mazeofminds.com/34/how-to-change-text-selection-color-using-css3/</link>
		<comments>https://mazeofminds.com/34/how-to-change-text-selection-color-using-css3/#comments</comments>
		<pubDate>Sun, 10 Jul 2011 07:17:43 +0000</pubDate>
		<dc:creator>Tomas</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">https://mazeofminds.com/?p=34</guid>
		<description><![CDATA[<p>This is quick and easy way to do a little branding to your or your client’s website. If you want to see this CSS3 effect in action you have to use Opera 9.5+, Chrome 2+ or Safari 3.1+ browser and just select text in mazeofminds.com. To make it work on other browsers we have to use vendor prefixes.</p> <p>The code example to achieve this effect :</p>]]></description>
				<content:encoded><![CDATA[<div class="full-image"><img src="/wp-content/uploads/css3_txt_color.jpg" alt="Text Color in CSS3" title="css3_txt_color" width="460" height="220" class="alignnone size-full wp-image-35" /></div>
<p>This is quick and easy way to do a little branding to your or your client’s website. If you want to see this CSS3 effect in action you have to use Opera 9.5+, Chrome 2+ or Safari 3.1+ browser and just select text in mazeofminds.com. To make it work on other browsers we have to use vendor prefixes.<span id="more-34"></span></p>
<p><strong>The code example to achieve this effect :</strong></p>
<pre class="brush: css; title: ; notranslate">
::selection {

background: #111113;
color:#fff;
}

::-moz-selection {

background: #111113;
color:#fff;
}

::-webkit-selection {

background: #111113;
color:#fff;

}
</pre>
]]></content:encoded>
			<wfw:commentRss>https://mazeofminds.com/34/how-to-change-text-selection-color-using-css3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
