nth-of-type不适用于div

时间:2016-05-04 09:47:25

标签: css css-selectors

我有3个div,都是thirtytwo类,我试图使用nth-of-type这样设置它们:

.thirtytwo:nth-of-type(1){ style.. }

但由于某种原因,没有任何事情发生,任何人都知道它可能是什么?

1 个答案:

答案 0 :(得分:1)

        value=0
        for report in Leavetable.select().where(Leavetable.Employee_ID==employees_id):
            for dt in rrule(DAILY, dtstart=report.From_Date,until=report.To_Date):
                if (dt.weekday() < 5):
                    if (report.To_Date>=from_date and report.From_Date<=to_date):
                        value += 1 
                    print value

&#13;
&#13;
Your code works fine.
&#13;
.thirtytwo{ 
  width: 32%; 
  float: left; 
  text-align: center; 
  box-sizing: border-box; 
  padding: 10px; 
  border:1px solid;
} 
.thirtytwo:nth-of-type(1){ 
  margin-right: 2%!important; 
} 
.thirtytwo:nth-of-type(2){ 
  margin-right: 2%!important; 
} 
.thirtytwo:nth-of-type(3){ 
  margin-right: 0%!important; 
} 
&#13;
&#13;
&#13;

也许会尝试检查你的元素,因为你可能会留下一个未封闭的元素或在你的3个div上面打开。