Aman Turate Aman Turate - 5 months ago 18
CSS Question

I want to create a custom list as shown in screenshot and i am using bootstrap

The List Which I want to make.

My main css code is:

.bg-blue {
background-color: #022E3D;
color: white;
}

.bg-blue ul li {
background-image: url(http://s32.postimg.org/fdofyahrp/Icon.png);
background-repeat: no-repeat;
padding-left: 5em;
background-size: auto;
padding-bottom: 3em;
}
.bg-blue ul li::before {
content: " ";
min-height: 59px;
display: block;
background-color: #d5d5d5;
width: 1px;
position: relative;
top: 3.5em;
left: -50px;
}

.bg-blue ul li:last-child:before {
content: " ";
background-color: transparent;
}


Here is the Fiddle :https://jsfiddle.net/amanturate/sznqax6b/7/

The main problem text not being aligned next to the image. Is there a better way out? I am using Bootstrap v3.

Answer

Use :after pseudo-element instead of :before and adjust top position of the pseudo-elements':

.bg-blue ul li::after {
  content: " ";
  min-height: 59px;
  display: block;
  background-color: #d5d5d5;
  width: 1px;
  position: relative;
  top: 2em;
  left: -50px;
}

.bg-blue ul li:last-child:after {
  content: " ";
  background-color: transparent;
}