Great observation! This is a common issue when mixing RTL text with list bullets in HTML.
Why does this happen?
When you set direction: rtl on a <li>, the bullet (list marker) often moves to the right side of the list item. However, depending on the browser and CSS, the bullet may be hidden or not appear as expected because the bullet is outside the content box and the padding/margin may not accommodate it properly.
How to fix the missing bullet for RTL list items?
You need to explicitly control the padding and list-style-position so the bullet is visible on the right side for RTL items.
Working solution example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>RTL and LTR List</title>
<style>
ul {
padding-left: 1.5em; /* default padding for LTR bullets */
padding-right: 0;
}
li.ltr {
direction: ltr;
text-align: left;
list-style-position: outside;
}
li.rtl {
direction: rtl;
text-align: right;
list-style-position: outside;
/* Adjust padding so bullet shows on the right */
padding-right: 1.5em;
padding-left: 0;
}
</style>
</head>
<body>
<ul>
<li class="ltr">This is an English sentence.</li>
<li class="rtl">هذه جملة عربية.</li>
<li class="ltr">Another English sentence.</li>
<li class="rtl">جملة عربية أخرى.</li>
</ul>
</body>
</html>
Explanation:
-
For LTR items:
padding-left: 1.5em on the <ul> ensures bullets appear on the left.
li.ltr keeps default padding and direction.
-
For RTL items:
- We remove left padding and add
padding-right: 1.5em on the <li> so the bullet appears on the right.
direction: rtl and text-align: right ensure the text flows correctly.
Result:
- English list items have bullets on the left.
- Arabic list items have bullets on the right and the bullet is visible.
Bonus: If you want the entire list to be mixed direction but bullets always visible:
You can also set the <ul> to direction: ltr or rtl depending on your main language, but the above per-<li> approach is the most flexible.
If you want me to help with a more complex example or dynamic content, just ask!