I am trying to include a vertical line both before and after the list tag. However, the first list tag is not displaying properly with the vertical

I encountered an issue where, despite adding a line using the "before" concept, the first list tag's left sideline is missing. The error output can be viewed here. The desired output should look like this: here

Here is the HTML Code:

    <div class="top-sm">
      <ul>
      <a href="#"><li><i class="fab fa-facebook-f"></i></li></a>
      <a href="#"><li><i class="fab fa-twitter"></i></li></a>
      <a href="#"><li><i class="fab fa-linkedin-in"></i></li></a>
      <a href="#"><li><i class="fab fa-youtube"></i></li></a>
      </ul>
    </div>

This is the corresponding Style:

    .top-sm li{ display:inline-block; list-style:none;margin: 0;position:relative;padding: 15px 8px 0;}
    .top-sm li:before{content:""; position:absolute;top:0;right: 6px;width:1px;height: 55px;background: white;}

Answer №1

Ensure to make necessary updates to your HTML as it is currently considered invalid. To add borders to lines, you can utilize the border property as demonstrated in the snippet below.

.top-sm li {
  display: inline-block;
  list-style: none;
  margin: 0;
  position: relative;
  padding: 15px 8px 0;
  border-left: 1px solid #000;
}

.top-sm li:last-child {
  border-right: 1px solid #000;
}
<div class="top-sm">
  <ul>
    <li><a href="#"><i class="fab fa-facebook-f"></i>1</a></li>
    <li><a href="#"><i class="fab fa-twitter"></i>2</a></li>
    <li><a href="#"><i class="fab fa-linkedin-in">3</i></a></li>
    <li><a href="#"><i class="fab fa-youtube"></i>4</a></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

How can you position navbar links to the right in Bootstrap?

I have been given an assignment that requires me to create HTML code to replicate a specific webpage design, which can be viewed here: https://i.sstatic.net/GC68r.png One of the requirements is to align the Home, Contact, About Us, and Messages links to t ...

concealing frames within a frameset with the help of javascript

Is it possible to create multiple frames with individual borders, each featuring an icon that allows users to hide and show the frame by clicking on the icon? ...

Can the conventional HTML context menu be swapped out for a link context menu instead?

Currently, I am working on developing a custom linkbox component that is similar to the one found on this page: Here is an example of the code: export const Linkbox = ({}) => { const linkRef = useRef(null); return ( // eslint-disable-next-l ...

Tips on obtaining a standalone text node using Selenium WebDriver

Is there a way to extract the text from a tag while excluding the text from nested tags? For example, if we only want to retrieve the string 183591 from within the <small> tag and not the text Service Request ID: from the <span> tag. The challe ...

Refining data within table rows based on selected options

Currently, I am facing an issue with filtering a table using a select option. After the initial filter, I am unable to show all the data again. Additionally, I am seeking assistance in making my code more concise. // STRUGGLING TO SHOW ALL DATA AFTER INIT ...

Mobile-exclusive carousel feature

I am currently working on a project where I need to create a carousel specifically designed for mobile devices. I want the carousel to display only one image at a time on screens with a resolution lower than 650px, while on larger screens, a standard grid ...

The feature for choosing rows is not functioning properly when using materializecss in Tabulator

While working on my project, I encountered an issue with selecting rows. After some debugging, it was revealed that the culprit behind this behavior is the tabulator_materialize.min.css file. Interestingly, when I don't use this CSS, everything functi ...

Concealing a div element if the value is null

Here's my code: if ($image1 !=='') { //Insert div here } However, I'm encountering parse errors when I try to place the div within the curly brackets. Is there a specific syntax or format that I am missing...? ...

Changing a form into a static display format

Currently, I am working on designing a profile page layout. During the editing process of their profiles, I aim to showcase a form similar to the one provided in the Bootstrap library: https://getbootstrap.com/docs/4.4/components/forms/#form-row. Once use ...

Utilizing JSON data to populate a modal window in HTML

How can I incorporate JSON data into an HTML modal window? I have a set of 12 buttons, and when a user clicks on one, I want to display the corresponding month's information from a JSON file. let myJson; $(`button`).on(`click`, function() { let ...

Can you explain the purpose of the text-align property set to justify-all?

Can you explain what the CSS property text-align: justify-all does? According to MDN, it should justify even the content of the last line. However, I am not seeing any changes in my Chrome browser: <p style="text-align: justify-all"> one two thre ...

CSS guidelines specifically for when two classes are required to exist simultaneously

Is there a specific effect that can only be achieved when two classes are present simultaneously? For example: .positive{ color:#46a546; } .positive:after{ content: "\25b2"; } .negative{ color:#F00; } .arrow:after{ content: "\25bc"; ...

What are some ways to modify the appearance of the post title table using CSS?

In this snippet of HTML code- <table style='min-width:60%;height:25px;'> <tr> <td><b><data:post.title></b></td> <td id='date-and-author' style='position: relative;bo ...

Is there a way for me to verify if the link with the attribute "rel=preconnect" has successfully completed its task

After adding link[rel=preconnect] to my HTML code, I am curious how I can verify if preconnect is actually working. I noticed that preconnect does not show up in the Network panel of DevTools, nor do I see it in chrome://tracing. What tools are available ...

The image appears fuzzy until you hover over it and it transforms into a larger size

Encountering a strange issue with using the zoom property on an image during hover state. The image seems to be blurry before and after the scale transition, but surprisingly sharp during the actual transition. Any tips on how to prevent this blurriness in ...

FitText.js malfunctioning

I'm currently experimenting with using FitText.js to dynamically adjust the size of headlines to fit within the limits of the browser width. Interestingly, while this script successfully resizes the text in multiple sections of my website, it seems t ...

Ensure that the child iframe is referencing its own content, and not that of the parent iframe

What I have is a nested Iframe setup as shown below <iframe id="is Static"> stuff <iframe id="Is Dynmic> <html>...</html> <body id="This is thebody"> other stuff </body> I am trying to listen for the mou ...

Unable to link name with the corresponding latitude and longitude information

: I have a page that displays 15 LI items and I'm struggling to convert the complex nested HTML data into a simple JSON object containing the name, latitude, and longitude. Here's an example of how a single record should look: {name: "Pied a T ...

BX-Slider allows for the insertion of Prev and Next Arrows in both the Main Div and Inner Divs

I am facing an issue with positioning inner boxes (divs) to the left or right of each slide while adding some text. Although styling them is easy, the problem arises when the Previous and Next arrows appear inside the secondary/inner div, as shown in the a ...

Obtain the value of the background image's URL

Is there a way to extract the value of the background-image URL that is set directly in the element tag using inline styling? <a style="background-image: url(https:// ....)"></a> I attempted to retrieve this information using var url = $(thi ...