When the ::after pseudo element is utilized for creating a bottom border, it will display following each individual list item contained within the specified div

I have been using a pseudo-element to create a division line between sections, and it was working perfectly until I added a list of items. Now, the division line is appearing after every <strong> and <li> tag. I have tried various approaches, such as giving the last <li> a class and applying the pseudo element to it, but it only creates a border below the word in the <strong> tag and ignores the rest of the list item.

#OurPart ::after {
  content: "";
  display: block;
  margin: 30px auto 30px;
  width: 20%;
  border-bottom: solid 2px #5d9cd4;
}
<div id="OurPart">
  <p>
    It's not surprising that many businesses are stuck in a cycle of repetitive actions, hoping for a change that never comes. True success doesn't come from repetition—it requires game-changing shifts in understanding perceptions, needs, and expectations from stakeholders and audiences. By transforming foresight into effective strategies, we develop sustainable growth plans for your business. Our expertise combines industry knowledge with analytics to generate innovative ideas and strategies that lead to success. We help businesses envision their future and achieve better outcomes through strategic thinking and commercial excellence. We're strategists, innovators, and problem solvers operating at the intersection of foresight and strategy to deliver winning solutions. We turn demand into value by
  </p>
  <ul>
    <li><strong>INVESTIGATION</strong>—by engaging with your target market and addressing their pain points</li>
    <li><strong>UNLOCKING</strong> insights with business acumen</li>
    <li><strong>ANCHORING</strong> strategy in market foresights to create actionable business plans</li>
  </ul>
</div>

Answer №1

Ensure there is no space between #OurPart and pseudo if you want to style only below the ID.

Use #OurPart::after instead of #OurPart ::after.

If you want to design elements below li or p tags, make specific changes as shown in the snippet below.

To target only the last li tag, use last-child like this
#OurPart li:last-child::after

#OurPart p::after {
  content: "";
  display: block;
  margin: 30px auto 30px;
  width: 20%;
  border-bottom: solid 2px #5d9cd4;
}

#OurPart li::after {
  content: "";
  display: block;
  margin: 30px auto 30px;
  width: 20%;
  border-bottom: solid 2px #5d9cd4;
}
<div id="OurPart">
  <p> It comes as no surprise that more and more businesses are repeating everyday moves hoping that this repetition will bring a change desperately needed. The success will not come from repetition. It comes from game-changing shifts that requires different
    way in understanding of perceptions, needs and expectations from key stakeholders and target audiences. By turning foresight into compelling strategies, we create credible and lasting growth strategies for your business. We combine our deep industry
    knowledge with analytics expertise to co-create innovative thinking and strategies that lead you to success. We enable businesses re-imagine their future and transform their outcomes with commercial excellence. We are strategic thinkers, opportunity
    explorers and designers. We operate in a space where foresight meets strategic thinking to unlock winning thoughts and solutions. We turn demand into value through </p>
  <ul>
    <li><strong>INVESTIGATION</strong>, by talking to your targeted market and learning about their pain points</li>
    <li><strong>UNLOCKING</strong> those insights with business acumen</li>
    <li><strong>ANCHORING</strong> strategy in these strong market foresights and turn it to actionable business plans</li>
  </ul>
</div>

Answer №2

just insert the tag after the pseudo css class is applied. That's all ;)

#OurPart li::after{
    content: "";
    display: block;
    margin: 30px auto 30px;
    width: 20%;
    border-bottom: solid 2px #5d9cd4;
}
<div id="OurPart">
  <p>It comes as no surprise that more and more businesses are repeating..</p>
  <ul>
    <li><strong>INVESTIGATION</strong>, by talking to your targeted market and learning about their pain points</li>
    <li><strong>UNLOCKING</strong> those insights with business acumen</li>
    <li><strong>ANCHORING</strong> strategy in these strong market foresights and turn it to actionable business plans</li>
  </ul>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Deactivating a button if the input fields are blank using ReactJS

Hi there, I'm new to reactJS and recently encountered an issue with my code. Everything seems to be working fine except for the NEXT button not being disabled when text fields are empty. My expectation is that the NEXT button should only be enabled af ...

Implement a jQuery feature to gradually increase opacity as the user scrolls and the page loads

On a dynamically loaded page via pjax (except in IE), there are several links at the bottom. Whenever one of these hyperlinks is clicked, the page scrolls to the top while still loading. Although I am okay with this behavior, I'm curious if it' ...

What sets apart Material UI's gutterBottom from a paragraph?

Can you explain the distinction between these two options? While exploring the Typography Component API, I noticed that both the gutterBottom and paragraph props seem to serve the same purpose. If set to true, the margin bottom will be 0. You can find mor ...

Multi-object retrieval feature in Material Dialog

I am encountering an issue with Material Dialog when confirming the action to "remove row" in a table. Initially, removing from the dialog works fine and deletes a row. However, after closing the dialog and re-calling it for the second time, the removal ac ...

Integrating the Google Translate tool onto a website

My goal is to integrate a translation tool like Google Translator or other reliable options onto my website. I am not looking to translate the entire content of my pages into another language, but instead want to add a feature similar to the one found on t ...

Ways to trigger a modal programmatically in the backend code?

My goal is to trigger the display of a modal when a button is clicked. The modal should be shown by clicking this button: <asp:Button ID="Button4" runat="server" class="btn btn-info" data-toggle="modal" OnClientClick="return false;" data-target="#View1 ...

What is the process for sorting non-integer records in MySql?

I need help sorting MySQL records in descending order to retrieve the most recent entry. Here are the records stored as strings: 1/2017 1/2018 2/2017 2/2018 3/2017 I specifically want to retrieve the value 1/2018. The entries correspond to each year an ...

HTML table designed to work in both Internet Explorer and Firefox, with a header and footer that remain fixed while allowing vertical and

I am in need of a highly functional HTML super-table. I am open to using jQuery or any other JavaScript library, regardless of potential drawbacks, as long as it meets the following requirements. It must support: Compatibility with at least IE8 and the ...

Something is off with the CSS height property

I am facing an issue with setting the height of a div inside another div. To better illustrate my problem, here is the code snippet: .prodContent1 { position: absolute; background-color: #e1e1e1; border: 1px solid #ddd; width: 100%; box-sizi ...

Align Image According to Dimensions of the Browser

I'm looking for a way to dynamically position an image based on the width and height of the browser within an HTML file. I know that adjusting an image's width/height is possible through code like this: <script> ...

Viewport height-responsive image not functioning as expected in Firefox browser

Is there a way to set an image to the 100% height of the browser window, with a small padding at the bottom, and have it centered on the page? I created an example in codepen that works well in Chrome and Safari, but not in Firefox. In Firefox, the image ...

Stop Scrolling on Web Pages with HTML5

I need assistance in preventing all forms of page scrolling within my HTML5 application. Despite searching on popular platforms like SO and Google, I have been unable to find a comprehensive solution for disabling all scrolling mechanisms entirely. Existin ...

Is it possible to modify the underline color while using the transition property in CSS?

One of the challenges on my website is customizing the navigation bar to resemble the BBC navigation bar. I want to change the border bottom/underline color using transition elements. Can anyone provide guidance on modifying the code to achieve this look? ...

Aligning images with absolute CSS to text that is wrapping positions the images perfectly alongside the text content

My webpage has a long content section that resizes based on the browser width. Here's an example: <h1 id="loc1">Title</h1> <p>bodycopy bodycopy bodycopy bodycopy bodycopy bodycopy bodycopy bodycopy bodycopy bodycopy bodycopy bod ...

New to CSS/Ruby - What causes two adjacent buttons to have varying sizes?

The varying sizes of my search and login buttons located beside each other are puzzling me. Could it be due to the fact that the search button is enclosed within a submit_tag argument while the login button is not? If this is indeed the case, how can I mak ...

What is the process for ensuring that an image is set as the submit button in an HTML form on IE 7?

My HTML form is designed with an action on a PHP script, and the submit button displays a custom image instead of the default grey. While this code works perfectly in Chrome, it fails to function properly in Internet Explorer 7. Do you have any suggestions ...

When trying to submit a form, encountering an `Uncaught ReferenceError` due to calling ajax within

Attempting to trigger an ajax function within a form in order to retrieve a value for the dropdown. mypython.py @app.route('/new_data', methods = ['POST', 'GET']) def new_data(): #Filter data and return the data(data_lis ...

Position the division at the location of the cursor for particular usemap components

Looking for a way to position a division on top of an image using a usemap. Interested in having the div only appear when the mouse hovers over a particular area, and at the precise location of the cursor. Came across some examples using jQuery, similar ...

It is not possible to delete a class from an element once it has been added

Issue can be replicated by visiting the following URL: Click on the hamburger icon to open the navigation menu Click on "Services" Click "< Services" within the submenu to attempt to go back For some reason, the removeClass method is not removing the ...

Javascript editing enhancement for real-time changes

Are there any tools for in-place editing of Javascript code? I'm looking for something similar to Firebug, which is great for instant CSS editing and previewing but doesn't have the capability to edit JavaScript directly. Is there a tool or addon ...