I have unordered list which has bulleted text within. I need to indent the list items in line. However for long running text, the style is not working as expected. I should make it aligned within the border box. Here is the css code
ul{
background-color: #FFFFFF;
border: 1px solid black;
border-radius: 3px 3px 3px 3px;
list-style: disc inside none;
padding: 10px;
}
Here is the example HTML
<div style="padding:20px">
<ul>
<li>Should be minimum of 8 characters</li>
<li>A long running text A long running text A long running text A long running text A long running text</li>
<li>Should have at least one number</li>
</ul>
</div>
JS Fiddle link : http://jsfiddle.net/jHJXq/
Like an ordered list element, an unordered list element (<ul>) will indent its list items — or bullet points — by default. If you'd like to change the indentation distance, then you can use the margin-left or padding-left property.
Right-click, and then click Adjust List Indents. Change the distance of the bullet indent from the margin by clicking the arrows in the Bullet position box, or change the distance between the bullet and the text by clicking the arrows in the Text indent box.
Use margin-left if you want the entire paragraph to be shifted to the right. If you want the entire paragraph to be shifted over, not just the first line, then you can use the margin-left property.
No. HTML code does not need to be indented, and all browsers and search engines ignore indentation and extra spacing. However, for any human reader, it's a good idea to indent your text because it makes the code easier to scan and read.
Is this what you are looking for? http://jsfiddle.net/jHJXq/3/
ul{
background-color: #FFFFFF;
border: 1px solid black;
border-radius: 3px 3px 3px 3px;
list-style: disc outside none;
padding: 10px 10px 10px 25px;
}
I changed the list style to "outside" and gave some extra padding to the left.
Add style to the LI
:
li {
margin-left:15px;
}
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