<?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>CyberAP</title>
	<atom:link href="http://cyberap.net/feed" rel="self" type="application/rss+xml" />
	<link>http://cyberap.net</link>
	<description>CyberAP personal site, XenForo free and premium styles</description>
	<lastBuildDate>Mon, 07 May 2012 18:56:34 +0000</lastBuildDate>
	<language>ru</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Styling XenForo breadcrumbs</title>
		<link>http://cyberap.net/post/styling-xenforo-breadcrumbs</link>
		<comments>http://cyberap.net/post/styling-xenforo-breadcrumbs#comments</comments>
		<pubDate>Sun, 19 Feb 2012 07:26:10 +0000</pubDate>
		<dc:creator>CyberAP</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[xenforo]]></category>

		<guid isPermaLink="false">http://cyberap.ru/?p=315</guid>
		<description><![CDATA[Styling breadcrumbs is a big problem in XenForo since its arrows were made via borders and have no customizable background. A lot of designers just escape it, leaving the breadcrumb&#8217;s look out of the design. We&#8217;ll try to improve the situation by making a css3 breadcrumbs that don&#8217;t use just only borders and nothing else. <a href="http://cyberap.net/styling-xenforo-breadcrumbs/#more-315" title="Read the full article &#171;Styling XenForo breadcrumbs&#187;" class="more-link button simple">Read more</a></p>]]></description>
			<content:encoded><![CDATA[<p>Styling breadcrumbs is a big problem in XenForo since its arrows were made via borders and have no customizable background. A lot of designers just escape it, leaving the breadcrumb&#8217;s look out of the design. We&#8217;ll try to improve the situation by making a css3 breadcrumbs that don&#8217;t use just only borders and nothing else.</p>

<span id="more-315"></span>

<div class="section">
	<h4>Preparation</h4>
	<p>The first thing we want to do is to remove all borders in the arrows, or just leave a 1px border in the inner arrow. The final output should look like this:</p>
	<img src="http://cyberap.ru/wp-content/uploads/2012/02/step1.png" alt="" title="step1" width="483" height="174" class="aligncenter size-full wp-image-371" />
	<p>Then you should set all the margins and paddings that suit your style. I set a 0 4px 0 10px padding for the crust link and a 20px right margin on the crust itself.</p>
</div>

<div class="section">
	<h4>Styling arrow</h4>
	<p>Now we can style our arrows. Set the background the same as in your crust (Item Content), repeat this action with the border.</p>
	<small>Little hint: you can use the inheritance by setting your colours as a @property.background-color or @property.border-color, where @property is the name of the property whose parameter you want to get.</small>
	<p>When this is all done we can move to the main part.</p>
</div>

<div class="section">
	<h4>The hack</h4>
	<p>We will rotate our arrow in order to get it look to what it was like before the modification. The css3 property we will use is called <i>transform: rotation(degree);</i>. And the rotated element will be our inner arrow, not the outer arrow. Why do we do this? Because our outer arrow is a holder that will hide all the unnecessary elements of the rotated inner arrow. Here is the code the you should put in the Miscellaneous section in &#8216;Item Arrow, Inner&#8217; property.</p>
	<pre class="sectionMain"><code class="language-css">
transform: rotate(-45deg);
-o-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
	</code></pre>
	<p>The next thing we want to do is to set the proper width and height for arrows. As our outer arrow is the holder we want to make it the same height as the crust, in my case I have 24px line-height in the crust and a 1px border, so the final height is 26px, we should set it for the outer arrow. The width will be 20px and it depends on your paddings in the crust. For the inner arrow we want to make it smaller because after rotation we don&#8217;t need such a big element. In other words, we want it to suit the height of the crust when rotated. After some testing I came up with the decision the the inner arrow should be a bit larger than the height of the crust (to be clear it should be 1px larger). Because if it has the same size after rotation as the crust it doesn&#8217;t look well and miss the right corners. So the height and width of the inner arrow should be tested anyway if you have any parameters that differs from mine ones. For me it was 18px (with borders I get 20px).</p>
	<img src="http://cyberap.ru/wp-content/uploads/2012/02/step2.png" alt="" title="step2" width="300" height="229" class="alignleft size-full wp-image-374" />
	<img src="http://cyberap.ru/wp-content/uploads/2012/02/step3.png" alt="" title="step3" width="297" height="204" class="alignleft size-full wp-image-375" />
	<p>After all the calculation is done it is the best time to set a correct positioning. The outer arrow should have an absolute positioning and inner arrow may have a relative or absolute positioning. For our outer arrow we should set right to 20px and top to 0. This will move our outer arrow to the right and stick it to the top. For the inner arrow the top property depends on its height and width. For me it was top 3px. The right should be 10px because our outer arrow has a width of 20px.</p>
	<p>The last thing is overflow. Since our outer arrow is the holder of the inner arrow we should set an <i>overflow: hidden;</i> to it in order to hide the remaining part of the inner arrow. Once it is done your arrow should display correctly.</p>
	<img src="http://cyberap.ru/wp-content/uploads/2012/02/example1.png" alt="" title="example1" width="147" height="42" class="alignleft size-full wp-image-377" />
</div>

<div class="section">
	<h4>One more thing</h4>
	<p>&#8220;What about box shadows and linear gradients?&#8221; &#8211; you might ask. That&#8217;s what for the modification was done!</p>
	<p>For the linear-gradients you just need to set the correct angle. If your gradient is straight from bottom to top you just need to set the angle to 45 degrees. In other cases just add 45 degrees to your crust original linear gradient angle.</p>
	<p>For box shadow you need to imagine that the box was rotated on the left and modify your original box shadow from crust with a correct positioning. For example if we have an inset box shadow with 0 on x and 1px on y we should now imagine that the box rotated and shift our box shadow to the top left corner. So we will get a -1px on x and 0 on y.</p>
	<p>But there is a problem with outer shadows. Do you remember that our outer arrow has an <i>overflow: hidden;</i>? That hidden overflow means that our shadow of the Inner arrow will be cut. To escape it we should create a pseudo-element that will emulate our inner arrow and create a shadow for it. I will just simply show the code with some comments:</p>
	<pre class="sectionMain"><code style="language-css">
.crumbs .crust:after
{
	content: ""; /* makes this element actually work */
	display: block; /* required to set height and width */
	position: absolute;
	top: 50%;
	margin-top: -9px; /* equals the half of the height, to position in the middle */
	right: -10px; /* half of the outer arrow width */
	width: 18px; /* should be the same as the outer arrow width, with no regard to border */
	height: 18px; /* should be the same as the outer arrow height, with no regard to border */
	box-shadow: -1px 1px 2px rgba(0,0,0,0.2); /* shadow, corrected in respect to rotation + 1px for y axis  */
	z-index: 1;
	
	transform: rotate(-45deg);
	-o-transform: rotate(-45deg);
	-ms-transform: rotate(-45deg);
	-moz-transform: rotate(-45deg);
	-webkit-transform: rotate(-45deg);
}
	</code></pre>
	<p>And the last thing is to set the correct z-indexes. The .crust a (Item Content) should have <i>z-index: 1;</i> (don&#8217;t forget about <i>position: relative;</i> in order to get it working) and outer arrow should have <i>z-index: 3;</i>. This will set the layers to a correct level.</p>
</div>

<div class="sectionMain section">
	<h5>Final result</h5>
	<span class="crumbs example">
		<span class="crust">
			<a href="http://cyberap.ru" class="crumb">
				<span>Home</span>
			</a>
			<span class="arrow">
				<span></span>
			</span>
		</span>
		<span class="crust">
			<a href="http://cyberap.ru/community/" class="crumb">
				<span>Forums</span>
			</a>
			<span class="arrow">
				<span>></span>
			</span>
		</span>
	</span>
</div>]]></content:encoded>
			<wfw:commentRss>http://cyberap.net/post/styling-xenforo-breadcrumbs/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

