Create HTML <ol> and <ul> Lists Online
The HTML List Generator creates an ordered <ol> or unordered <ul> list from the lines you enter. Each line becomes one <li> element, and the preview, HTML output, and C# output update together.
Choose an ordered list when item sequence carries meaning, such as instructions or rankings. Choose an unordered list when the items form a set and their sequence is not essential.
HTML List Generator Options
- Type selects an ordered list (
ol) or unordered list (ul). - Lines supplies the list content, with one item created for each line.
Entered text is escaped in the generated markup, so characters such as < and & remain text instead of being interpreted as HTML.
Create HTML <ol> and <ul> Lists in C#
The C# panel shows how to create the configured list with Aspose.HTML for .NET . The generated code follows this workflow:
- Create an
HTMLDocument. - Use
CreateElement()to create the selectedolorulcontainer. - Create one
lielement for each entered line and assign its text throughTextContent. - Connect the items and list with
AppendChild(), then writelist.htmlwithSave().
Choose the list type and enter the items before copying the updated C# code.
HTML List Generator FAQ
1. When should I use <ol> instead of <ul>?
Use <ol> when changing the item order would change the meaning, as in steps, rankings, or chronological sequences. Use <ul> when the items belong together but their order is not significant.
2. How does the generator turn entered text into list items?
Each line becomes the text of a separate <li> element inside the selected list. Special HTML characters are escaped, so pasted markup is displayed as text rather than inserted as nested elements.
3. Can I change the numbers or bullet markers?
The generator creates the semantic list structure. After copying it, use CSS list-style-type and related list properties to choose an appropriate marker without changing the meaning of <ol> or <ul>.
4. Can this generator create nested lists?
It creates one list level only. To build a nested structure, place another <ol> or <ul> inside the relevant <li> after copying the markup, or create that hierarchy with the Aspose.HTML DOM API.
5. Can a generated list item contain a link or another HTML element?
The Lines field creates text-only items and escapes markup. After copying the result, add links or other permitted content inside the required <li> elements in HTML or through the DOM API.
Get Started with Aspose.HTML for .NET API
Install Aspose.HTML for .NET from NuGet with the .NET CLI:
dotnet add package Aspose.HTML
You can also use the NuGet Package Manager UI or run Install-Package Aspose.HTML in the Package Manager Console. See the
installation guide
for setup details, or request a
temporary license
to evaluate the API without evaluation limitations.
Other Supported HTML Generators
Create and preview markup for other common HTML elements.