更改特定行的背景
目前,我正在从事一个Book Store Web应用程序的项目。我想像一行一样更改行的背景,下一行是白色的,然后继续进行。我的任务是使用CSS执行此操作。
您可以在图片中看到。我想更改“小说”行灰色,我想要下一行“恐怖”保持白色并改变“冒险”行,然后这样。数据来自数据库一个,我无法一个一个接触它们。
Currently, I am working on a project which is Book Store Web Application. I want to change the background of the rows like one row is grey, the next row is white and goes on like this.Also my task is doing this using CSS.
You can see in picture. I want to change the "Novel" row grey, I want the next row which is "Horror" stay white and change "Adventure" row to grey and it goes on like this. The datas come from the database one by one and I cannot reach them one by one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您使用的是ASP.NET MVC,因此我会假设您正在使用Bootstrap。
您需要做的就是在
< tbody></tbody>
上添加.table striped
或遵循此示例:
对于普通的CSS解决方案,请尝试此尝试。 :
bootstrap 5条纹桌文档:
Since you are using asp.net MVC I will assume you are using bootstrap.
All you need to do is add
.table-striped
on<tbody></tbody>
or follow this example:
For a plain CSS solution try this:
Bootstrap 5 striped table docs: Striped table