mixture of left-to-right and right-to-left text orientation used within

When attempting to mix ltr and rtl content within a single paragraph, the entire paragraph aligns based on the rtl direction. This means that if the first span is rtl and the second is ltr, the second span will appear before the first one.

In the sample code below, you can see that in the first list group, the time appears first when it should actually appear second as shown in the next group.

<!DOCTYPE html>
<html lang="en">

<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>

<body>

  <div class="container">
    <h2>List Group With Custom Content</h2>
    <div class="list-group">
      <a href="#" class="list-group-item active">
        <h4 class="list-group-item-heading">First List Group Item Heading</h4>
        <p class="list-group-item-text"><span>الفاتحہ.</span><span>0:11</span>
        </p>
      </a>
      <a href="#" class="list-group-item">
        <h4 class="list-group-item-heading">Second List Group Item Heading</h4>
        <p class="list-group-item-text"><span>Fatiha</span><span>0:11</span>
        </p>
      </a>
    </div>
  </div>

</body>

</html>

Answer №1

The issue arises when the p and span elements do not have a specified directionality, causing them to default to the natural direction of their content if no other elements dictate otherwise.

One potential remedy is to replace the final span within each p with a bdo, although more elegant solutions likely exist.

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

<div class="container">
  <h2>List Group With Custom Content</h2>
  <div class="list-group">
    <a href="#" class="list-group-item active">
      <h4 class="list-group-item-heading">First List Group Item Heading</h4>
      <p class="list-group-item-text"><span>الفاتحہ.</span><bdo dir="ltr">0:11</bdo>
      </p>
    </a>
    <a href="#" class="list-group-item">
      <h4 class="list-group-item-heading">Second List Group Item Heading</h4>
      <p class="list-group-item-text"><span>Fatiha</span><bdo dir="ltr">0:11</bdo>
      </p>
    </a>
  </div>
</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

Discovering dynamic content enclosed by static values in Applescript

Just starting out with applescript and facing a challenge. I need to extract a string from a web page via Safari and assign it to a variable. The target string varies, but the words before and after it remain constant. For instance: Apple 1293.34 USD The ...

Having trouble with Javascript/jQuery not functioning in IE8?

My current project involves a website that functions smoothly in Chrome, but encounters issues with running JavaScript/jQuery scripts in IE8. Even a simple alert on page load fails to execute. Admittedly, my approach is a bit messy as I have mixed CSS an ...

Step-by-step guide on using JQuery to listen to an event and dynamically add a p element after a button, with the feature to remove it on click

I need to implement a functionality where clicking a button will add a new paragraph after the button, and then be able to remove that paragraph by clicking on any word within it. Any guidance on how to achieve this would be highly appreciated. Thank you! ...

One-of-a-kind Version: "Utilizing CSS to Capitalize an

Imagine having the following strings. i and we. me and you. he and she. Is it possible to achieve the desired result using PURE CSS? I and We. Me and You. He and She. If capitalizing the text using text-transform: capitalize is used, it will yi ...

Newcomers to Visual Studio Code facing a problem with images not displaying

As a beginner in all aspects, I am currently facing an issue with displaying an image on Visual Studio Code. The problem arose when I tried to create a separate folder for the image, which resulted in a cascade of subfolders that only made things worse eac ...

Is anyone else experiencing issues with the jQuery slide-in not working on a particular website? How can I determine which version of jQuery is compatible with this site?

Essentially, I am looking to have a div box slide in on the page as it loads. This method has worked successfully on other websites and HTML previews that I have tested it on so far. However, for some reason, it does not seem to work on this specific websi ...

How can I showcase both a username and email address in a Material UI chip?

I'm currently using Material UI chip to show name and email next to each other. However, when the name is long, the email goes beyond the chip boundary. Here's my function that generates the chips: getGuestList() { let {guests} = this.sta ...

Encountering a problem when trying to connect an array from the server to the HTML portion using AngularJS in combination with Asp

Encountering errors on chrome, I suspect the html loading faster than the array causing synchronization issues. Received an array from the Server. Utilized the array in the html section to bind array items to Paths, ids, and tag elements. The issue aris ...

Animate CSS with Javascript in reverse direction

Forgive me if this is a silly question, but I'm having trouble. I need a slide-in navigation menu for smaller screens that is triggered by JavaScript. Here is what I currently have: HTML <nav class="responsive"> <ul class="nav-list unstyl ...

Using external components, such as antd, with Style JSX in a NextJS project is not functional

I am exploring the use of Style JSX within a Next JS application to customize AntD components, with a focus on customizing the appearance of the sidebar (specifically using Style JSX to modify AntD's Sider component). Below is a snippet of the code I ...

Utilizing CSS Scroll-snap for Seamless Navigation

Attempting to create a basic carousel using scroll-snap, but encountering an issue where the carousel is randomly scrolling on load instead of starting with the first picture. See code snippet below. Any ideas on resolving this? .carousel { ...

Create a scrollable modal body that dynamically adjusts its content to the end, situated between the header and footer

I am facing an issue with my modal setup. The content in the body is quite lengthy and I want it to be scrollable, but the height of the body should end where the footer begins. Currently, the height of the body extends over the footer, making it impossib ...

Conceal social media icons when hovering over specific images similar to the feature on the website medium

I am facing an issue with fading out social links that appear over medium and large images on a webpage. I want the social links to fade out when they are over the images and fade back in once they move off the images. The number of medium and large images ...

Organizing Data Tables Based on Selected Rows

I am working with a datatable that includes a table with checkboxes in the first column. I am trying to figure out how to sort the table so that when a checkbox is checked, the corresponding row will move to the top of the table. <table class="table ...

Utilizing special German characters such as Umlaut in HTML code

Attempting to include German characters in HTML has proven challenging for me. I have tried using special character codes such as &Uuml; and &#220; but have not had any success with proper rendering. Can someone help me troubleshoot this issue? Tha ...

Tips for evenly distributing list elements in HTML without using whitespace

After reading the article on flexbox techniques without actually using flexbox, I attempted to implement "space-between" in my code: ul { margin: 0; padding: 0; text-align: justify; } ul:after { content: ""; display:inline-block; width:100%; ...

How many characters can a URL contain?

Could you please clarify the maximum character limit for a URL, specifically when it is created using the GET method from a form? ...

"Navigation Side Menu: w3-sidebar with hamburger toggle feature

If you are looking to implement the w3-sidebar, you can find it here: https://www.w3schools.com/w3css/tryit.asp?filename=tryw3css_sidebar_over The existing code uses a "hanburger" icon to open the side menu and a "Close X" menu item to close it. To simpl ...

Issues with the functionality of Bootstrap

Upon loading the page, I am encountering an issue with a collapse on the 'main' id. It fails to collapse initially and only functions correctly after being clicked. I have not utilized 'collapse in', so I am unsure why this behavior per ...

What is the best way to implement target="_blank" in an anchor tag using 'sanitize-html'?

In my current project, I am utilizing the sanitize-html library. Let's say I receive an email containing an anchor tag like this: this is to test something <a href="https://www.google.com/">open google</a> When this email shows up in my ...