You can have a background image on the same element, overlaying it with a transparent gradient.
Since you are probably using gradients to give an element a glossy or three-dimensional feel, box shadows work much better for this. This is because linear gradients always stretch to the full size of the element (which can grow with user input), while a natural shine or shadow only highlights a fixed size on the top or bottom.
Browser support for linear gradients is a mess. I avoid using them. In particular, IE 7-9 can only emulate gradients with a weirdo DirectX filter directive which has issues.
Examples
Take this gradient from top to bottom:
background-image: linear-gradient(top, red 0%, bottom 100%);
Do you need DevOps-experts?
Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!
We build reliable cloud solutions with Infrastructure as code