Rabu, 11 September 2024

Multilevel Nested List In Web Page

Type this following HTML source code in your web editor:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="assets/styles.css" media="all"/>
</head>
<body>
<h3>Multilevel nested list.</h3>
<ol>
<li>Coffee</li>
<li>Tea
<ol>
<li>Black tea</li>
<li>Green tea</li>
</ol>
</li>
<li>Milk</li>
</ol>
</body>
</html>
Save as MultiLevelNestedList2.htm

Type this following CSS source code in your web editor:
ol {
counter-reset: section;
list-style-type: none;
list-style-position: outside;
padding-left: 0;
}
ol li {
list-style-position: outside;
padding-left: 0;
}
ol li ol {
padding-left: 1.5em;
}
ol li::before {
counter-increment: section;
content: counters(section, ".", numeric) ".";
padding-right: 0.5em;
}
Save as styles.css inside folder assets

Bibliography

https://www.browserstack.com/
https://www.w3schools.com/

Related Post

Tidak ada komentar:

Posting Komentar