Define the length of the separator used in the list

Seeking guidance on adjusting the length of a list separator using CSS. Currently, I am utilizing the following code:

ul li {
border-top: #00000 1px solid;
}

I am interested in setting the length of the separator using padding. For instance, I would like the separator to begin from the letter "t".

https://i.sstatic.net/ocUjr.png

If anyone could provide assistance, it would be greatly appreciated. Thank you!

Answer №1

Check out this solution:

ul {
  list-style: none; 
  width: 300px;
  background: red;
  padding: 0;
  margin: 0;
  overflow: hidden
}

ul li {
  padding: 0 10px 10px;
  margin-bottom: 10px;
  position :relative;
}

ul li:first-child {
  padding-top: 10px;
}

ul li:after {
  position: absolute;
  bottom: 0;
  left: 15px; /* custom value can be set here */  
  height: 1px;
  background: blue;
  width: 100%;
  content: '';
}

ul li:last-child {
  margin: 0; 
}

ul li:last-child:after {
  content: none;
}

ul li:last-child:after {
  content: none;
}
<ul>
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
    <li>Item 4</li>
  </ul>

Answer №2

Give this a shot: using border-bottom will create a bottom line and using list-style-type will eliminate the bullets:

ul li {
    border-bottom: 1px solid red;
    list-style-type: none; 
}

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

The form within the dynamically loaded AJAX content is malfunctioning

My webpage is set up to load content from a separate file (content.php) into a div and refresh it every 5 seconds. In the content.php file, I have a form (basic HTML without javascript) that works fine when accessed directly at (example.com/content.php). ...

the ajax success function is malfunctioning

I'm encountering an issue with my ajax function. I am trying to change the CSS for certain HTML elements on 'success', using the following code: success:function(d){ $('#name').css('weight','normal'); ...

How to Arrange Information Harvested from While and For Loops?

I am attempting to display the posts of a user's friends, similar to the layout of Facebook's main page. Currently, to echo out a user's friend's posts, the database table for that user contains a reference to a text file. In my case, t ...

PHP integration with input forms

Is there a way to have multiple text fields that input data into various sections on a single webpage? If necessary, I could split the content over two pages. I've heard that this may involve using a PHP script, but I'm unsure of the steps to imp ...

On the x-axis of the D3 graph, each data point is precisely the width of a date

I am currently trying to visualize data based on dates, and I am aiming for something similar to the following: My goal is to create rectangles that represent each day's data. Here is how I am drawing the rectangles: svg.selectAll(".my_class") .data ...

Issue encountered when attempting to conceal navigation buttons in navbar post user login due to Stack Overflow error

Is there a way to hide the login button in the masterpage header once the user is logged in? Here are the relevant codes: SiteMaster.Master.aspx <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="SiteMaster.Master.cs&q ...

showcase 7 content sections in a two-column layout

I have a large container with 7 smaller containers inside <div id="big_div"> <div>a</div> <div>a</div> <div>a</div> <div>b</div> <div>b</div> <div>b</div><div>b</d ...

What is the process for showcasing ImageGridFSProxy in an HTML file?

I am facing an issue with displaying images stored in MongoDB on a web page using Flask. The records have a binary field named "payload". class BinaryFile(mongo.Document): created_at = mongo.DateTimeField(default=datetime.datetime.now, required=True) ...

What is the best way to extract the text from a <div> tag and show it in a different div when clicked on using ng click in AngularJS?

When the button is clicked, the text in ng-model=name should be displayed in the <h2> tag. <div ng-model="name">This is a text</div> <button ng-click="getname()">Click</button> <h2>{{name}}</h2> ...

What is the best way to extract data from the ajax.done() function?

My question revolves around the function shown below: $.ajax({ url: "../../getposts.php" }).done(function(posts) { var postsjson = $.parseJSON(posts); }); I am wondering how I can access the variable postsjson outside of the .done() function sco ...

How do I retrieve the content within this HTML element using JavaScript based on its ID?

Is there a way to extract the string from this specific HTML element using JavaScript? The element has an id of recItemString_GPLA\|input, and within it, there is a string containing "qty" that I need to retrieve. Upon inspection of the element, the f ...

How can I effectively retrieve the JWT in a node environment?

I've successfully set up JWT authentication using Node.js. After the user signs in, Node.js generates a JWT and sends it back to be stored in the localStorage. However, I've encountered an issue when trying to access this token within the express ...

Request financial data from AlphaVantage using PHP

I'm currently working on utilizing the alphavantage API to retrieve currency exchange information. In order to obtain the desired data, I am using the following query URI: https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_cu ...

What is the best way to convert my create-react-app project into a standalone HTML file that includes embedded JavaScript?

For a test assignment for a new job, I completed a simple create-react-app project. However, there is a requirement that the project must be submitted as a single HTML file with embedded JS and CSS. How can I convert my create-react-app project into a sin ...

What is hindering me from fetching the information stored in my json file?

Currently, I am delving into learning AngularJS by working on a simple webpage for a company. This page will showcase products that are fetched from a json file. Following a tutorial from the AngularJS website, which covers the exact task I aim to achieve, ...

menu icon not being hidden in media query

Currently, I am in the process of developing a landing page using a combination of HTML/CSS and Javascript. Everything seemed to be functioning smoothly with the media query max-width: 768px. However, when attempting to implement the media query for min-wi ...

Creating Interactive Lookup Field with JQuery and PHP

Recently, I followed a guide on how to develop a lookup field that dynamically searches a MySQL database table - the main objective is to facilitate contact search by postcode. While I managed to get the search functionality working and display the value o ...

What are effective methods for testing HTML5 websites?

I'm currently working on a project to create a dynamic website using HTML5. The first page will prompt the user for specific inputs, and the following page will adjust accordingly based on these inputs. My main concern now is how to effectively test ...

Adjust the page height when switching between two divs

Currently, I have two divs that are being displayed one at a time using the toggle method. Please refer to the screenshot below: In the image provided, when the user clicks on "show more", the div will toggle based on the first item in the list. If the u ...

I continue to encounter an "Anticipated bracket" and "Surprising symbol" malfunction

I am currently working on a website using Wordpress and I am facing a problem with making the header full-screen while maintaining responsiveness. I want the code to only apply to desktop PCs and tablets, but I am encountering errors such as expected bra ...