简体   繁体   English

移动问题上的 CSS thead 渐变背景

[英]CSS thead gradient-background on mobile issue

I have a gradient in my table css.我的表格 css 中有一个渐变。 On desktop browsers like Chrome, Firefox and Safari it looks as intended, however on mobile browsers it does not have the intended effect.在 Chrome、Firefox 和 Safari 等桌面浏览器上,它看起来像预期的那样,但在移动浏览器上却没有预期的效果。 Gradient is supposed to stretch on the entire header but on mobile it repeats on header cells instead.渐变应该在整个标题上拉伸,但在移动设备上它会在标题单元格上重复。

Anyone able to help me?任何人都可以帮助我吗?

This is how it looks on desktop这是它在桌面上的样子

This is how it looks on mobile这是手机上的样子

This is the css that I implementen.这是我实现的css。 Should be fine but I cannot figure out why it doesn't work on mobile.应该没问题,但我不知道为什么它在移动设备上不起作用。

 table thead { background: linear-gradient(to right, #ffcf28, #f28d00); background-image: -webkit-linear-gradient(right, #ffcf28, #f28d00); } table th:first-child { border-top-left-radius: 8px; } table th:last-child { border-top-right-radius: 8px; } table th { color: white; background-color: transparent; }
 <table> <thead> <tr> <th>Kostensoort</th> <th>Tarief</th> </tr> </thead> <tbody> /* cut the cells for clarity */ </tbody> </table>

I am using the tr selector but it is not working on mobile (iOS - chrome, safari and mozilla)我正在使用 tr 选择器,但它不适用于移动设备(iOS - chrome、safari 和 mozilla)

any other workaround to make this work?任何其他解决方法来使这项工作? thanksss谢谢你

 tr:nth-child(odd) { background: linear-gradient(90deg, rgba(51,51,51,1) 0%, rgba(91,91,91,1) 35%, rgba(118,118,118,1) 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#333333",endColorstr="#767676",GradientType=1); width: 100%: }

this is what it looks like in mobile这就是它在手机中的样子

it should be like this... (desktop)应该是这样的...(桌面)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM