How should I align the list to the right? The text aligns perfectly, however bullets do not. Is there a simple and easy way to do so with CSS?
Code:
<ul style="text-align: right">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
Even if I put the rules for LI elements directly to be aligned to the rigth, it does not work.
EDIT I have attached an image showing what I want to achieve:
To make a right-aligned version of the list, only three changes need to occur. First, set the "UL" "text-align" to "right". Second, change the left "background-position" from "0" to "100%" - which makes the image align up with the right edge. And finally change "padding-left" to "padding-right".
You need to bring the bullet points inside the content flow by using list-style-position:inside; , and then center align the text.
If you need to align the bullets with the text you can use the list-style-position
attribute, as follow:
.theList
{
text-align: right;
list-style-position: inside;
}
Use direction:
direction: rtl;
It is generally used for right to left languages.
edit:
Float each to the right and clear both.
float: right;
clear: both;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With