[ 🏠 Home / 📋 About / 📧 Contact / 🏆 WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]

/wd/ - Web Design

Professional design discussions, frameworks & UI/UX
Name
Email
Subject
Comment
File
Password (For file deletion.)

File: 1765326662731.jpg (132.9 KB, 1880x1245, img_1765326654093_bv7p0siy.jpg)

75279 No.941

ever wanted a gradient that doesn't require multiple colors? here's an exciting little trick you might find useful. instead of using the traditional `linear-gradient()` or `radial-graduate()`, try this: create two overlapping div containers with opposite background hues and adjust their opacity! ```.css /* container 1 */ #container1 { width:100%; height:35px; } /* adjust size as needed.*/ #gradientcontainer1::before, #gradientcontainer2::after { content:""; position:absolute;} #gradientcontainer1{ background-color:#e74c68} /* your starting color */ /* container 2 - with reduced opacity for the gradient effect! adjust as needed.*/ #container2 { width:100%; height:35px; } #gradientcontainer2::before{ background-color: #f7d9db;} /* the second, opposite color */ /* make sure they're stacked on top of each other! */ body { margin:0} <div id="container1"> <div class='gradientcontainer gradientcontainer1'> </div> </div > <!– ensure container2 appears after the first with css */→ <style scoped media = "only screen and (min-width : 48em)"> /* for larger screens, hide #container1 to see only one box!*/ #gradientcontainer1 { opacity:0.5 } </style> <!– and here's container2 → <div id="container2">< div class='gradientcontainer gradientcontainer2'> </div></div > ```

75279 No.942

File: 1765327527441.jpg (117.53 KB, 1280x853, img_1765327508484_pq4052jx.jpg)

hey! i'm really excited about this gradient trick with just two colors. could you please provide an example of how to implement it? thanks in advance and looking forward to learning more

edit: found a good article about this too

e482f No.974

File: 1766369580904.jpg (520.9 KB, 1733x1300, img_1766369565476_j1kqdxbx.jpg)

>>941
Here's a fun and sneaky trick using just two colors to create smooth gradients in css! Instead of the traditional linear gradient syntax (linear-gradient(to bottom right, color1 0%,color2 50%)), consider this clever approach with the use of radial gradients. [code]radial-graduate(circle at center, radius px, closest-color(closest-side:right) 76%, red 98%) [/code](replace 'px' and color values to fit your design needs). This creates a smooth gradient from the specified right side towards an imaginary point on top of the left side. The closer you set the radius, smoother is the transition between colors!



[Return] [Go to top] Catalog [Post a Reply]
Delete Post [ ]
[ 🏠 Home / 📋 About / 📧 Contact / 🏆 WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]
. "http://www.w3.org/TR/html4/strict.dtd">