Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9063967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:07:50+00:00 2026-06-16T16:07:50+00:00

I have a collection that I rendering but would like to show a border

  • 0

I have a collection that I rendering but would like to show a border between items and not at the end. Is this possible?

render :partial => 'classrooms/classroom_result', :collection => @result, :as => :classroom

_classroom_result.html:

<div style='border-bottom:1px solid #CCCCCC;'>
  <%= classroom.name %>
</div>

Basically is there a way to differentiate the last item in the collection for styling purposes? In this example I don’t want to there to be css of border-bottom on the last item because I have a border surrounding the entire collection.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T16:07:51+00:00Added an answer on June 16, 2026 at 4:07 pm

    First off this is a CSS issue, not really a Rails issue.

    To do this, you need a proper stylesheet. I do not think you can do this with an inline style as you are. Next your <div> needs a CSS class to identify this list of <div>s and then you use the :last-child pseudo-selector to disable the border on the last element.

    In your stylesheet:

    .classroom {
      border-bottom:1px solid #CCCCCC;
    }
    
    .classroom:last-child {
      border-bottom:0;
    }
    

    In your partial:

    <div class="classroom">
      <%= classroom.name %>
    </div>
    

    That should do it. Also, :last-child will not work in <= IE8, but will in most other relatively recent browsers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The situation is like this: I have an Observable Collection that has a bunch
I have a ko.computed() function that proxies a collection like this: function ListView(query) {
I have a collection that contains all the items that I want to keep
I have 3 collection datatable that shows in this below Month: January ID NAME
I have Backbone.js collection that holds (for example) 30 items. I want to pass
Background I have a custom collection that is binded to the datagridview this.datagridview.DataSource =
I'm rendering a partial in a collection like this : <%= render :partial =>
I want to databind an ItemsCollection, but instead of rendering the collection items, I
So I have a View that looks like this. //base class var SelectListView =
I have a collection of items and I am building a simple interface that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.