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

The Archive Base Latest Questions

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

In CSS, for the example shown below, how can I make it such that

  • 0

In CSS, for the example shown below, how can I make it such that the styles get applied to all paragraphs, except for the first and the last paragraph?

<div class="entry">
    <p>...</p>
    <p>...</p>
    <p>...</p>
    <p>...</p>
    <p>...</p>
</div>

I’ve tried the following to exclude the first paragraph, but that doesn’t work:

div.entry p:nth-child(n+1) {
    /* ... */
}

I’ve also tried nth-of-type() and not(), but couldn’t get them to work the way I thought they would.

Edit: I’ve decided to wrap all the <p>s which I want to apply the style to in a <div>. I’ve accepted bozdoz answer, because it came the closest to solving the original problem (even though it solved only half of it).

  • 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-28T20:10:30+00:00Added an answer on May 28, 2026 at 8:10 pm

    Updated answer:

    Use both :not(:first-child) and :not(:last-child)

    div.entry p:not(:first-child):not(:last-child)
    

    See updated JSFiddle.

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

Sidebar

Related Questions

Trying to find an example that has css rollover using sprites & sliding door
I have the following code example (see below). My problem is that the tooltip
The markup below is an example of a dynamically generated menu that is styled
I'm creating an epub file and am trying to understand an example css for
For example I have a css style like this : input.validation-passed {border: 1px solid
Does anyone know good example of using CSS to create rounded corner box where:
For example: like target = _self in XHTML and position:static in CSS
The CSS syntax highlighting in vim is not entirely optimal. For example: div.special_class stops
I am familiar with CSS techniques to replace text with an image. For example,
Example <span style=BACKGROUND-COLOR: #ffd700>Background color</span> How screen reader handle inline css ? is there

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.