ITPub博客

首页 > 移动开发 > ANDROID > 【HarmonyOS】鸿蒙背景色渐变叠加

【HarmonyOS】鸿蒙背景色渐变叠加

ANDROID 作者:afiua 时间:2024-09-26 13:00:18 0 删除 编辑

【HarmonyOS】仿前端css中的背景色渐变两层叠加

【HarmonyOS】鸿蒙背景色渐变叠加_鸿蒙

/*  * 前端css中的背景色渐变两层叠加效果  * <!DOCTYPE html> <html> <head>     <meta charset="UTF-8">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>Gradient Background Test</title>     <style>         .gradient-background {             width: 100%;             height: 100vh;             background-image:                 linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #f3f5f7 100%),                 linear-gradient(58deg, #4966ff 1%, #3489ff 50%, #28b2ff 100%);         }     </style> </head> <body>     <div>         <h1>测试</h1>     </div> </body> </html>  * */ @Entry @Component struct Page64 { build ( ) { Column ( ) { Text ( '仿前端css中的背景色渐变两层叠加' ) Stack ( ) { Text ( ) . width ( '100%' ) . height ( '100%' ) . linearGradient ( { angle : 58 , colors : [ [ 0x4966ff , 0.0 ] , [ 0x3489ff , 0.5 ] , [ 0x28b2ff , 1.0 ] ] } ) Text ( ) . width ( '100%' ) . height ( '100%' ) . linearGradient ( { angle : 180 , colors : [ [ 'rgba(255, 255, 255, 0)' , 0.0 ] , [ 0xf3f5f7 , 1.0 ] ] } ) Text ( '测试' ) } . width ( '200lpx' ) . height ( '200lpx' ) } . height ( '100%' ) . width ( '100%' ) } }

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24984661/viewspace-3107436/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-12-13

  • 博文量
    20
  • 访问量
    56754