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

  • SEARCH
  • Home
  • 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 8035307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:16:26+00:00 2026-06-05T02:16:26+00:00

I have some code that is generated by a Drupal view. It looks like

  • 0

I have some code that is generated by a Drupal view. It looks like this (stripped down for clarity):

<div class="group_content">
  <h3>Header Link</h3>
  <div class="row odd">Here's some content</div>
  <h3>Another Header Link</h3>
  <div class="row even">Here's some more content</div>
</div>

<div class="group_content">
  <h3>Header Link 2</h3>
  <div class="row odd">Here's some content 2</div>
</div>

Because this is generated by a CMS, there’s a limit to what I can do about the rendered code – for example, I can’t add an even/odd class to the h3 elements.

How can I (in css) target only the div class=row that is followed by another div class=row? If there are more than one row in a group, I need to add a bottom border to the div to act as a visual separator. So, using my example code, there would be a border applied to div class="row odd">Here's some content</div> because it has another row following it.

I’m a backend developer, so CSS is not my strong suit. We do need to support IE7.

  • 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-05T02:16:29+00:00Added an answer on June 5, 2026 at 2:16 am

    Modified Logic

    Since you need IE7 support, place the border on the h3 element instead:

    div.row + h3 {
        border-top: 1px solid black;
    }
    

    This will work in just about every modern browser, and IE7:

    Fiddle: http://jsfiddle.net/jonathansampson/BjUf9/1/

    Explicit Subjects in Selectors

    If you insist on placing it only on every div.row but the last, that’s a different story. You’re asking about moving the subject of a selector, which is not currently possible, but will be when browsers implement Level 4 selectors:

    div.row! + div.row {
        /* These styles apply to the first div.row
           $div.row + div.row is another potential 
           syntax */
    }
    

    :last-child, in IE9+

    Since you cannot do that, what you can do is set a style for all div.row elements, adding your border, and then overriding that for any div.row:last-child which will remove that border for any div.row that is the last element in its parent:

    div.row {
        border-bottom: 1px solid #333;
    }
    div.row:last-child {
        border-bottom: 0px;
    }
    

    Fiddle: http://jsfiddle.net/jonathansampson/BjUf9/

    I should note that this will not work in IE7, unfortunately. But the modified logic presented in the first solution should take care of you there.

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

Sidebar

Related Questions

I have some LINQ code that generates a list of strings, like this: var
I have some C# code that generates google maps. This codes looks at all
If I have some code that looks something like: typedef struct { bool some_flag;
I have some persisted XML that was generated by XStream, and looks like: <CalculationDefinition>
I have some code that, for the purposes of this question, boils down to
I have some code that I'd like to run on a page. My problem
I think I'm asking about covariant return types. I have some generated code that
We have some code that was generated, mostly likely by svcutil from an XML
Currently I have some code that is being generated dynamically. In other words, a
I have a C# class that gets generated using the wsdl.exe tool that looks

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.