0

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) %}

      <a class="university-widget w-inline-block" href="{{ category.url }}">

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

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

    {% endfor %}
  {% endif %}

CSS

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

Picture Evidence

enter image description here

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.