gpt4 book ai didi

html - 如何使用 CSS 应用渐变?

转载 作者:太空宇宙 更新时间:2023-11-04 11:06:01 24 4
gpt4 key购买 nike

我在一个 iOS 元素中。我使用支持 HTML CSS JS 的 UIWebView。我有背景。我想将渐变黑色变为白色,它必须是透明的。

实际上我会在 Future 中更改背景,所以它必须显示具有透明度(渐变)的背景图像。

其中 Image 在整个背景上是 UIImageView 上的,而 UIWebView 是 subview 。

如果我用

    NSString *htmlStringQuestion = [NSString stringWithFormat:
@"<style type='text/css'>*
{
padding:0px; margin:0px;
}
div.ContentWrapper {
width:100%%; height:100%%;
text-align:center;
display:table;
}
div.ContentArea {
display:table-cell;
vertical-align:middle;
padding:0 5%%;
background:none;
background-color: rgba(0, 0, 0, 0.5);
color: #00000;
font-size:30;
font-family: Baskerville;
}
</style>
<div class='ContentWrapper'><div class='ContentArea'>
<p>Hello</p>
</div>
</div>", htmlString];

看起来像

enter image description here

任何建议。

但我想要一些黑色到白色,从顶部到白色的东西。

最佳答案

background: -webkit-linear-gradient(top,  rgba(0,0,0,1) 0%,rgba(255,255,255,0) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, rgba(0,0,0,1) 0%,rgba(255,255,255,0) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */

注意:我用了 Ultimate CSS Gradient Generator获取此代码。你可以用它来生成你喜欢的任何 css 渐变。我不隶属于该网站。

关于html - 如何使用 CSS 应用渐变?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33956037/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com