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 6663365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:29:28+00:00 2026-05-26T02:29:28+00:00

One thing I often want to do when laying out a website is to

  • 0

One thing I often want to do when laying out a website is to have some elements next to each other, with separators between them. For instance, if I have three elements, I’d want two separators between them, and nothing at either end.

I achieve this in various ways. For vertical stacking of elements, I sometimes use <hr />. Horizontally, I might do something like:

<div>
    <span class="notend">things</span>
    <span class="notend">stuff</span>
    <span>items</span>
</div>

.notend {
    border-right: solid black 1px;
}

Is there a more semantic way of doing this? I want to have separators between elements without putting styling elements into the HTML part, or using non-semantic classes. I don’t mind of this requires hacky CSS, I just want to get stuff to do with styling away from the HTML files.

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

    Use this:

    #menu span + span {
        border-left: solid black 1px;
    }
    

    http://jsfiddle.net/thirtydot/QxZ6D/

    That will apply border-left to all except the first span.

    The adjacent sibling selector (+) is supported in all modern browsers except IE6.


    Another way to do it is this, which is sometimes nicer because you can keep all the declarations for the “menu buttons” in one block:

    http://jsfiddle.net/thirtydot/QxZ6D/1/

    #menu span {
        border-left: solid black 1px;
        /*
        a: bunch;
        of: stuff;
        */
    }
    #menu span:first-child {
        border-left: 0
    }
    

    This has exactly the same level of browser support as the first solution.

    Note that if you like this solution, it’s better to use :first-child rather than :last-child, because :first-child (from CSS2) is supported in IE7/8 and :last-child (only introduced in CSS3!) isn’t.

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

Sidebar

Related Questions

One thing I've started doing more often recently is retrieving some data at the
I often have data where I want to compare the value of one level
Often I'm creating reports in Visual Studio's Crystal Reports and want to have a
so i have got two models with each one controller: Model Project has_many Themes
I have recently begun using coderush. One thing that annoys me is that the
One of the things I find myself doing often is passing string literals as
One thing I've always wanted to do is develop my very own operating system
One thing I really miss about Java is the tool support. FindBugs, Checkstyle and
One thing that's really been making life difficult in getting up to speed on
One thing I've always wondered about is how software patches work. A lot of

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.