<p>I can't see why Craft would be breaking a CSS rule, you're outputting three items and is it outputting the 3 items on the page?</p>

<p>If yes, then the CSS rule might need to be fixed. If not, then I don't understand your problem.</p>

CC BY-SA 3.0
2017-04-13T15:44:46.200Z
2017-04-13T18:09:12.360Z
2017-04-13T18:09:12.360Z
Brad
<p>For some reason, when outputting 'featured' tagged items, It's ordering them I presume by alphabetical values which is breaking the nth-child CSS set on every 3rd element? Is there anyway to stop this?</p>

<p><strong>Getting Tagged Categories</strong></p>

<pre><code>  {% set tag = craft.tags.slug('featured').first() %}
  {% set categories = craft.categories.relatedTo(tag) %}

  {% if categories|length %}
    {% for category in categories.limit(3) %}

      &lt;a class="university-widget w-inline-block" href="{{ category.url }}"&gt;

        {% for asset in category.universityImage %}
          &lt;div class="university-widget-image" style="background-image:url({{ asset.url }})"&gt;&lt;/div&gt;
        {% endfor %}

        &lt;div class="university-widget-content"&gt;
          {% for asset in category.universityLogo %}
            &lt;img class="university-widget-logo" src="{{asset.url}}" height="40"&gt;
          {% endfor %}
          &lt;p class="small-paragraph university-widget-description-test" id="university-widget-description"&gt;{{ category.description }}&lt;/p&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    {% endfor %}
  {% endif %}
</code></pre>

<p><strong>CSS</strong></p>

<pre><code>.university-widget:nth-child(3n)
{
  margin-right:0px;
}
</code></pre>

<p>Picture Evidence</p>

<p><a href="https://i.sstatic.net/Gh7c8.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Gh7c8.png" alt="enter image description here"></a></p>

<entries><categories>
Craft Ordering breaking nth child?
# Craft Ordering breaking nth child?

(Asked by: username_0 on 2017-04-13)

For some reason, when outputting 'featured' tagged items, It's ordering them I presume by alphabetical values which is breaking the nth-child CSS set on every 3rd element? Is there anyway to stop this?
Getting Tagged Categories
  {% set tag = craft.tags.slug('featured').first() %}
  {% set categories = craft.categories.relatedTo(tag) %}

  {% if categories|length %}
    {% for category in categories.limit(3) %}

      

        {% for asset in category.universityImage %}
          
        {% endfor %}

        
          {% for asset in category.universityLogo %}
            
          {% endfor %}
          {{ category.description }}
        
      

    {% endfor %}
  {% endif %}

CSS
.university-widget:nth-child(3n)
{
  margin-right:0px;
}

Picture Evidence

**Tags:** entries, categories

---

## 1 answers

### Answer by username_1 on 2017-04-13. Score: 1

I can't see why Craft would be breaking a CSS rule, you're outputting three items and is it outputting the 3 items on the page?

If yes, then the CSS rule might need to be fixed. If not, then I don't understand your problem.


---

