I want to insert an html element after all my li
s.
For example:
Html:
<ul>
<li>some text</li>
<li>some text</li>
<li>some text</li>
</ul>
Css:
li:after{
content:"<div class="someclass"></div>";
}
but it doesn't work
I want to insert an html element after all my li
s.
For example:
Html:
<ul>
<li>some text</li>
<li>some text</li>
<li>some text</li>
</ul>
Css:
li:after{
content:"<div class="someclass"></div>";
}
but it doesn't work
Unfortunately, you can't do that with CSS. But it's possible in JavaScript, for instance with jQuery .append();
method.
// Add Baz to .myList
$( ".myList" ).append($("<li>Baz</li>"));
<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul class="myList">
<li>Foo</li>
<li>Bar</li>
</ul>
If you need to show some graphic element after each li element the option is to use an url in the content property:
content: url(/pictures/logo.gif);