Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Striking through a number in an ordered list CSS/HTML

Tags:

html

css

I have an HTML ordered list, that I need to apply a strikethrough to. I have done this in CSS as below:

.Lower-Alpha {
  list-style: lower-alpha;
  margin-top: 2pt;
  margin-bottom: 2pt;
  text-decoration: line-through;
}

The issue I am having is that this strikes through the content in the list, but not the number of the list (and I need to do both).

Eg I am getting: a. struckthrough content

but I need: a. struckthrough content

Any suggestions welcome. Cheers

like image 888
HaemEternal Avatar asked May 19 '11 11:05

HaemEternal


People also ask

How do you strike a number in CSS?

Complete HTML/CSS Course 2022 To mark strikethrough text in HTML, use the <strike>… </strike> tag. It renders a strikethrough text.

How do you add a strikethrough in HTML?

The <strike> tag was used in HTML 4 to define strikethrough text.

How do you start an ordered list on a different number in HTML?

The start value of an ordered list in HTML5 can be specified by implementing the HTML <ol> start Attribute and passing the starting value (number) as the value to the attribute.


2 Answers

easy as pie: list-style-position: inside;

http://jsfiddle.net/seler/NWbrR/

edit: it looks like it's browser dependent behaviour. in mozilla it renders ok.

edit2: for full browser compability u can use this js script: http://jsfiddle.net/seler/32ECB/

like image 57
seler Avatar answered Oct 31 '22 08:10

seler


@Haem; You can apply :after property

li:after{
    border-top:1px solid red;
    display:block;
    content:"";
    margin-top:-8px;
}

check the fiddle for more may be that's help you

http://jsfiddle.net/sandeep/NWbrR/4/

like image 40
sandeep Avatar answered Oct 31 '22 08:10

sandeep