Insert image after each list item
The easier way to do it is just:
ul li:after {
content: url('../images/small_triangle.png');
}
Adding an image in front of List Item
There are several methods to add an image to a list item.
Here is one using a background image. http://jsfiddle.net/p05g14zm/
rightNav2 li {
display: inline;
padding-right: 6px;
padding-left: 20px;
color: white;
}
.rightNav2 #homeLnk {
background-image: url('http://i.stack.imgur.com/vQ4nM.jpg?s=32&g=1');
background-repeat: no-repeat;
background-size: contain;
}
html/css adding an image for every for every listitem in my menu
please update below css with this one
#menu li a{
display:block;
font-family:Tahoma, Geneva, sans-serif;
font-size:12px;
color:#ffffff;
text-decoration:none;
background-color: #376596;
padding-top:2px;
padding-left: 20px;
padding-bottom: 2px;
background-image:url('http://images.subeta.net/smilies/6398_emoticon_smile.gif');
background-repeat:no-repeat;
}
you can check live click here
Adding single image after a specific list item
use nth-child
selector, like this:
.menuStyling li:nth-child(2):after{
content: url('../img/arrowActive.png');
}
where the 2nd <li>
will have the image.
see more on nth-child here
see a snippet below
.menuStyling li:nth-child(2):after {
content: " this is after child list item 2";
color: green
}
<ul class="menuStyling">
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
<li>item 4</li>
</ul>
Related Topics
Twitter Bootstrap White Gap on Right Side of Page
Why Do Professional-Made Websites Have Odd #Id and .Class Names
CSS Keyframe Animation CPU Usage Is High, Should It Be This Way
Getting Unordered List in Front of Image Slide-Show in IE8, IE7 and Probably IE6
Bootstrap 3 Arrow on Dropdown Menu
Css-Selector for Multiple Elements
CSS Set Width to Fill % of Remaining Area
How to Apply Ckeditor CSS to Output
Putting -Moz-Available and -Webkit-Fill-Available in One Width (CSS Property)
Bootstrap Responsive Columns Height
How to Make Text Appear on Next Line Instead of Overflowing
Svg with Radialgradient Not Work in Browsers
Differencebetween ".Class Element" and "Element.Class"
Chrome Get "User Agent Stylesheet"
How to Change Default Bootstrap Fluid Grid 12 Column Gutter Width