Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

CSS Background Gradient help

Featured Replies

Hi guys,

 

Im trying to put a CSS gradient effect on my websites menu buttons

Now ive got it working perfectly on Firefox but can get it to show on Chrome or Safari (havent checked IE as im on a mac)

 

Can someone help me iv been pulling my hair out all night, the code im using is below:

 

 

background-color: #343434;

background-image: -moz-linear-gradient(center top , rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%), url("../images/nav-item-pattern.png");

background-image: -webkit-gradient(center top , rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%), url("../images/nav-item-pattern.png");

 

appreciated guys

Edited by prezaeis

I may be wrong but you set gradients using background: not background-image: and I am not sure why you want a gradient and an image at the same time (or if you can even do that). Plus you need to indicate what type of gradient it is.

See Here

  • Author

I may be wrong but you set gradients using background: not background-image: and I am not sure why you want a gradient and an image at the same time (or if you can even do that). Plus you need to indicate what type of gradient it is.

See Here

 

the image im laying on top is just a transparent png file

its sort of a dusty texture, makes the buttons that little bit more shiny and funky!

 

thing is my code works perfectly in firefox, so just need to see what needs doing for other browsers

Try this:

 

#dustybutton { 
   background: url('../images/nav-item-pattern.png') no-repeat 0 0, rgb(30,87,153);
   background: url('../images/nav-item-pattern.png') no-repeat 0 0, 
               -moz-linear-gradient(center top , rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
   background: url('../images/nav-item-pattern.png') no-repeat 0 0, 
               -webkit-gradient(center top , rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
}

 

I've not tested it mind.. but if it doesn't work, you could try the older webkit format using color stops.

  • Author

thank you, finally went with this which worked, the above example didnt work :(

 

background-color: #343434;

    background: -moz-linear-gradient(top,  rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%); /* FF3.6+ */
   background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,0.1)), color-stop(100%,rgba(255,255,255,0))); /* Chrome,Safari4+ */
   background: -webkit-linear-gradient(top,  rgba(255,255,255,0.1) 0%,rgba(255,255,255,0) 100%); /* Chrome10+,Safari5.1+ */
   background: -o-linear-gradient(top,  rgba(255,255,255,0.1) 0%,rgba(255,255,255,0) 100%); /* Opera 11.10+ */
   background: -ms-linear-gradient(top,  rgba(255,255,255,0.1) 0%,rgba(255,255,255,0) 100%); /* IE10+ */
   background: linear-gradient(top,  rgba(255,255,255,0.1) 0%,rgba(255,255,255,0) 100%); /* W3C */
   filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1affffff', endColorstr='#00ffffff',GradientType=0 ); /* IE6-9 */

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.