Applying margins on a table-cell
is not possible, and the approach you are taking seems unconventional. Consider utilizing CSS positioning techniques for a more efficient solution, like in this example:
Check out the demo here.
Another demo (Using margin
on li
elements)
li {
list-style: none;
margin-left: 15px;
position: relative;
}
li::before {
content: "-";
position: absolute;
left: -10px;
}
In this instance, CSS positioning techniques are employed to move the `-
` prefixes outside the list item by applying a negative value for the left
property. This allows for the use of margin-top
and margin-left
properties on your li
elements, with the flexibility to adjust the position of the `-` as needed.
A helpful tip: Instead of using li
for text wrapping, consider using p
tags or <h2>
/ <h3>
tags for better semantic structure. By doing so, you can eliminate the need for unnecessary <br>
tags to separate lines, as these block-level elements will automatically create space for your content.