I've started using Twitter Bootstrap, which is useful for me (as a programmer) to get a decent looking site without having to write much CSS.
However something is driving me crazy. I have a nested list like
<ul>
<li>Hello</li>
<li>World
<ul>
<li>Wide</li>
<li>Web</li>
</ul>
</li>
</ul>
But the first and second level of this list are NOT getting indented differently (ie. they align with each other on the left)
In normal html nested lists, deeper sublists indent more. But something in the style sheet must be turning this off. How do I find what controls this? I can't see a CSS "list indent" attribute for li elements in any documentation.
Many developers choose to use 4-space or 2-space indentation. In HTML, each nested tag should be indented exactly once inside of its parent tag. Place a line break after every block element. Do not place more than one block element on the same line.
You can use the CSS text-indent property to indent text in any block container, including divs, headings, asides, articles, blockquotes, and list elements. Say you want to indent all div elements containing text on a page to the right by 50px. Then, using the CSS type selector div, set the text-indent property to 50px.
In typography, a form of indention in which each subsequent indent is set relative to the previous indent, rather than from the left (or right) margin.
The padding-left:0 is used to remove indentation (space) from left. The list-style: none property is used to remove list-style property from the list of items.
Just use Firebug in FF or Chrome dev-tools: right-click on your target and select inspect
element. You can visually and textually inspect the CSS properties to see what's causing the collapse.
You probably want a rule like
ul > li {
margin-left: 10px;
}
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