ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm trying to create a background gradient on my wepage. I've tried (in .css):
Code:
body { background-image: linear-gradient(top left to bottom right, rgb(105,153,255), rgb(226,250,255)) }
The above does nothing. Other permutations I've tried (I won't them them all) give me bands of gradients, about 4 bands vertically with gradients from left to right (e.g. using "to bottom right").
I'm using Microsoft Edge 117.0.
What is the correct syntax for a gradient starting at the upper left and going to the bottom right?
I'm trying to create a background gradient on my wepage. I've tried (in .css):
Code:
body { background-image: linear-gradient(top left to bottom right, rgb(105,153,255), rgb(226,250,255)) }
The above does nothing. Other permutations I've tried (I won't them them all) give me bands of gradients, about 4 bands vertically with gradients from left to right (e.g. using "to bottom right").
I'm using Microsoft Edge 117.0.
What is the correct syntax for a gradient starting at the upper left and going to the bottom right?
Try this (from quick look at The Book of CSS3 from NoStarch Press):
Code:
body { background-image: linear-gradient(to right bottom, rgb(105,153,255), rgb(226,250,255)) }
I am fortunate enough to have never experienced the edgy browser so no idea if it uses some other syntax, although the book indicates this should work from IE10.
Last edited by astrogeek; 10-12-2023 at 02:16 PM.
Reason: bottom right -> right bottom per examples
Actually, that didn't work. I must have had a table or DIV that took up much of the screen and I thought it was working. I still get bands of gradient. See attached. The stripped-down html is:
I take it background-image: linear-gradient() simply doesn't work other than "to right" or "to left". Any vertical or diagonal gradients band, as shown in my previous post. For example, I have this simple html:
This is takes the default direction of "Top to Bottom". It bands. So does "to bottom right". This happens on Linux Firefox 115.3.1esr, Windows Firefox 118.0.1 and Windows Edge 118.0.2088.46.
So, for directions other than "to right" or "to left" linear-gradient() just doesn't work in these browsers, agreed?
My go-to for css, among other things, is w3schools https://www.w3schools.com/colors/colors_gradient.asp
Sometimes I learn. Sometimes I just setup things as i want them to be and copy/paste the resulting code. Their “Try it yourself” editor is very useful.
Edit: just finished reading mfoley’s post. Not using Firefox at the moment. I’m typing on glass in Safari. Check out that link on Firefox. (I’ll try it later…)
My go-to for css, among other things, is w3schools https://www.w3schools.com/colors/colors_gradient.asp
Sometimes I learn. Sometimes I just setup things as i want them to be and copy/paste the resulting code. Their “Try it yourself” editor is very useful.
Edit: just finished reading mfoley’s post. Not using Firefox at the moment. I’m typing on glass in Safari. Check out that link on Firefox. (I’ll try it later…)
My target browser for this application is Edge. "to bottom" bands. In fact, it also bands on Firefox 118.0.2 on my Windows computer. "to right" seems to give the best results.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.