duanmie9682 2013-05-11 00:31 采纳率: 100%
浏览 50

如何在列中的每个第三个元素上强加唯一的样式属性? [关闭]

I am new to this site but I need help. I have successfully displayed records from and database with php. The records displays nicely with a CSS class. But what I really want is to change the class name after every three record display. In other words, three records will be display with the same css class name like (column) but the fourth record will use a difference class name like(column-last). Can someone please help me with this?

  • 写回答

2条回答 默认 最新

  • dougui4325 2013-05-11 00:34
    关注

    You can use CSS3's nth-child selector to selectively do so. For eg. let's say you are applying class myClass to the records. Now, add the following to CSS:

    .myClass:nth-child(4n) {
        // Your new properties
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图
  • ¥15 无线移动边缘计算系统中的系统模型
  • ¥15 深度学习中的画图问题
  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条
  • ¥15 Python报错怎么解决
  • ¥15 simulink如何调用DLL文件
  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离