Reputation: 524
.color-overlap-right {
background-color : #d93;
margin-right : -25%;
}
ol {
margin-left:0;
padding-left:0;
counter-reset: ol-item
}
ol li {
margin-left:0;
padding-left:0;
list-style-type:none;
counter-increment: ol-item;
}
ol li:before {
content:counter(ol-item) " ";
background-image: url('../img/square.png');
background-position: 0 -20px;
background-repeat: no-repeat;
}
<html lang="en">
<div class="container">
<div class="color-overlap-right">
<div class="left-text">
<ol style="list-style: aliceblue;">
<li>Earn</li>
<li>Transfer</li>
<li>Apply</li>
</ol>
</div>
</div>
</div>
I want to create a Ordered list in HTML which looks like this
This should have ordered list without a "dot" Numbering should be in italics and font-size customizable. should either have a background image/color as displayed. Can someone please help? I am currently able to remove the "dot" and add background color. However i am not able to adjust the margins between background image and number such that it looks similar to what is shown below. Can someone help?
Upvotes: 0
Views: 995
Reputation: 2680
I guess you just need to add some CSS property to achieve this design,
add these css in ol li:before
selector
ol li:before {
font-size: 39px;
color: #fff;
font-weight: bold;
padding-left: 15px;
text-shadow: -4px 2px 7px #504747;
font-style: italic;
font-family: sans-serif;
}
Edited
/*This is for square box*/
ol li:after{
content: "";
display: block;
background: #ab6b0b;
position: absolute;
top: 17px;
left: 3px;
height: 18px;
width: 17px;
}
Result would be like this:
You can modify font colors and shadow as per your UI
.color-overlap-right {
background-color: #d93;
margin-right: -25%;
}
ol {
margin-left: 0;
padding-left: 0;
counter-reset: ol-item
}
ol li {
margin-left: 0;
padding-left: 0;
list-style-type: none;
counter-increment: ol-item;
position: relative;
}
ol li:before {
content: counter(ol-item) " ";
background-image: url('../img/square.png');
background-position: 0 -20px;
background-repeat: no-repeat;
font-size: 39px;
color: #fff;
font-weight: bold;
padding-left: 25px;
text-shadow: -4px 2px 7px #504747;
font-style: italic;
font-family: sans-serif;
}
ol li:after{
content: "";
display: block;
background: #ab6b0b;
position: absolute;
top: 17px;
left: 3px;
height: 18px;
width: 17px;
}
<html lang="en">
<div class="container">
<div class="color-overlap-right">
<div class="left-text">
<ol style="list-style: aliceblue;">
<li>Earn</li>
<li>Transfer</li>
<li>Apply</li>
</ol>
</div>
</div>
</div>
Upvotes: 0
Reputation: 938
You could use something like this:
HTML:
<ol class="mylist">
<li>
<div> </div><span>Earn</span></li>
<li>
<div> </div><span>Transfer</span></li>
<li>
<div> </div><span>Apply</span></li>
</ol>
CSS:
body {
background-color: #d93;
}
.mylist {
font-size: 25px;
}
.mylist li {
position: relative;
counter-increment: section;
list-style: none;
margin-left: -20px;
z-index: 0;
}
.mylist li span {
font-size: 17px;
font-family: arial;
color: #FFFFFF;
}
.mylist li div {
position: absolute;
left: 0px;
bottom: 0px;
display: inline-block;
width: 15px;
height: 15px;
background-color: #D25F15;
z-index: 1;
border-radius: 2px;
}
.mylist li:before {
position: relative;
font-style: italic;
font-weight: bold;
color: #FFFFFF;
content: counter(section) " ";
margin-left: 12px;
z-index: 2;
}
Upvotes: 1
Reputation: 182
html {
background-color : #d93;
}
ol {
margin-left:0;
padding-left:0;
counter-reset: ol-item;
color:#fff;
font-family: arial;
}
ol li {
margin-left:0;
padding-left:0;
list-style-type:none;
counter-increment: ol-item;
}
ol li:before {
font-size:40px;
background: #d25f14;
content: counter(ol-item) ;
width:28px;
height:24px;
overflow:show;
display:inline-block;
background:url(place your image here);
text-align:right;
margin-bottom:20px;
margin-right:10px;
}
Use this CSS and make your image the way you want it
Upvotes: 0