Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE 8 doesn't support nth-child how can I solve this?

Tags:

css

IE 8 doesn't support nth-child how can I solve this problem ?

 #hm-top div:nth-child(1) h3 {
    color: #63c2ff;
    width: 300px;
    padding: 115px 0 0 0;
    background: url(images/trade.png) no-repeat center top;
    }
like image 217
Adeel Khanzada Avatar asked Mar 21 '23 20:03

Adeel Khanzada


2 Answers

IE8 however supports :first-child which is equivalent to :nth-child(1):

#hm-top div:first-child h3 {
    color: #63c2ff;
    width: 300px;
    padding: 115px 0 0 0;
    background: url(images/trade.png) no-repeat center top;
}
like image 115
dfsq Avatar answered Apr 11 '23 06:04

dfsq


equivalent to li:nth-child(1)
li:first-child { /* change to this */
    border-top: 5px solid red;
}
equivalent to li:nth-child(2)
li:first-child + li { /* change to this */
    border-top: 5px solid blue;
}
equivalent to li:nth-child(3)
 li:first-child + li + li { /* change to this */
    border-top: 5px solid green;
}​
like image 38
Khizer Najeeb Avatar answered Apr 11 '23 05:04

Khizer Najeeb