"Creating a stylish divider between words or sentences: A guide to using HTML and CSS for solid

I am curious about how to insert lines between words or sentences without using the common methods like border-bottom-line or js. Is it possible to achieve this effect using a simple span or div? I have attempted to do so myself, but I am open to learning if there is a better way.

Click here to view an image example.

.ll{
  display: flex;
  flex-direction: row;
}
<div class="ll">
  <span> one </span>
  <span>-</span>
  <span> two </span>
  <span>-<span>
  <span> three </span>
</div>

Answer №1

You have the capability to achieve this using pseudo elements.

.ll{
  display: flex;
  flex-direction: row;
}
span:after{
  content: '';
  display: inline-block;
  width: 15px;
  height: 4px;
  border-top: 2px solid red;
  margin: 0 10px;
}
span:last-child:after{
  width: 0;
  margin: 0;
}
<div class="ll">
  <span> one </span>
  <span> two </span>
  <span> three </span>
</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

JavaScript - Unable to unselect a button without triggering a page refresh

I have a series of buttons in a row that I can select individually. However, I only want to be able to choose one button at a time. Every time I deselect the previously selected button, it causes the page to reload when all I really want is for all the but ...

Saving and restoring the cursor/caret position in CKEditor 4: A how-to guide

While browsing similar questions on this topic, I realized that none of them really addressed my specific issue (or maybe I just need a better understanding of the concept). Initially, I embarked on the journey to acquire and manipulate the caret position ...

Adjust the height of a div element in the browser based on the content it contains

While I've come across similar questions, I have a query of my own... Is there a way to make the green div fill 100% of the browser window regardless of its content? http://jsbin.com/aculed/1/edit HTML: <div id="container"> & ...

Is there a bug with the CSS Safari selector for elements focused together?

Looking for a solution using the element+element-Selector to modify CSS for an element following a button. This code snippet functions in Chrome, Edge, and Firefox but not Safari on MacOS: .button:focus+.change{ color: red; } <p>When you focus ...

Discover an effective way to display Ajax search results above a different div element!

I am having trouble with positioning my search results on top of other divs. To see the issue, you can watch the screen recording by clicking on this link: https://drive.google.com/file/d/1kU_vl2ZAmSCok0pxnTTvY hacxqcZZ9m_/view?usp=sharing These are the s ...

CSS menu - Shifting bar: What's the issue?

I'm struggling to add a moving bar to my website's navigation and need some help. I tried following a tutorial at the following link: (http://css-tricks.com/jquery-magicline-navigation/) Here is what I ended up with: If anyone could take a look ...

Transform the € entity (which is stored in the database) into the € (Euro Symbol) within FPDF PHP

My MySQL database stores the euro symbol as "€", but when I display it in HTML, it shows as "€". Is there a way to convert "€" back to "€"? Here is the code snippet: function GetRate($NoPo){ global $dbname; $String = "SELECT ".$db ...

Width of the `div` element is expanding

I'm encountering an issue where a div container is automatically stretching to the full width of the page, instead of adjusting to fit the content within it. Below is the HTML code snippet: <!doctype html> <html> <!-- Head --> <h ...

Recalling a hidden div in a flexbox arrangement

I am facing a challenge with hiding and displaying two aside divs to enable a fullscreen view of my central div main. The layout is created using flexbox to assign proportions, but when I try to redisplay the elements, it disrupts the original design. Belo ...

Is there a way to turn off alerts from Aspx files for HTML and CSS?

Dealing with annoying warnings in my aspx files has been a constant struggle. The "CSS Value is not defined" message pops up when I reference CSS files from different projects, causing unnecessary frustration. Even more frustrating are the warnings about i ...

Tips for customizing the appearance of Java FX TableView column headers with CSS

I am relatively new to JavaFX and delving into CSS stylesheets, as well as using stackoverflow. I am curious about how one can customize the styling of a table column header. This is what my current column header looks like: Current appearance of my table ...

Unable to delete items or clear selection

Looking for ways to remove a dynamically created duplicate select element using JavaScript. I have a scenario where there are two types of select elements. The first one is visible after clicking the "Add Element" button, containing options "Access Contro ...

Tips for showcasing circles in a non-traditional layout

Is it possible to achieve the layout shown in the image below using CSS? I've tried using shape-outside: circle(); but it's not coming out as expected. Any suggestions on how to accomplish this? <!DOCTYPE html> <html lang="en"> <h ...

Showcasing a single item per row in carousels on small and medium-sized devices

I have successfully implemented a Bootstrap carousel to display 3 items in a row, which is working well. However, I am looking to modify it so that only one item is shown on smaller devices such as mobiles or tablets. Can anyone assist me with this? Belo ...

Is there a way to display x-overflow on a table instead of the window?

Check out the table at the following link: In my CSS, I set a min-width and overflow-x property for the table. However, on the mobile template, the overflow-x does not work properly. I want the template to display correctly with the header and footer in ...

full-page graphics with dynamic transition

I have been experimenting with creating a smooth fade-in and fade-out transition between two pages that feature full-screen images. My current approach involves using the swup plugin. To display a new full-screen image on each page, I assign a class to ev ...

How can I invoke a personalized function in angularjs from HTML?

One way to organize methods within js controllers is by defining them separately like this: angular.module('test').controller('mycontroller', mycontroller); function mycontroller() { //do something }; function ...

What factors could potentially cause Internet Explorer to fail in processing conditional comments effectively?

I am currently developing JSP pages with Tomcat and I need to ensure compatibility with IE 7, as requested by the client, along with Firefox and Chrome. Despite including both sets of code in my program, it seems to work perfectly fine for browsers other ...

Issues with the display of Bootstrap modal may occur when clicking an <a> tag

Attempting to open a modal by clicking on an <a> tag to display it centered vertically. However, upon clicking, the modal fails to appear at the center with the proper backdrop. In header.blade.php <div> <a class="header-text" href="#" ...

Ways to clear away adhesive header and maintain its fixed position

I've been tinkering with my website, which you can find at this link: . I used the html5 up template for it, and the template came with a sticky header. However, when the site is viewed on a smaller screen, there's an ugly gap that forms between ...