The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Gradient Background CSS
carsten chr
post Apr 1 2012, 05:48 PM
Post #1





Group: Members
Posts: 2
Joined: 18-June 11
Member No.: 14,789



Hi !......

This is driving me nuts !..... cool.gif

In my "stylesheet_background.css" file I've put:

body
{background-color: #787878;
background-image:-webkit-gradient(linear, left top, left bottom, from(#CDCDCD), to(#131313));
background-image:-o-linear-gradient(top, #CDCDCD, #131313);
background-image:-moz-linear-gradient(top, #CDCDCD, #131313);
filter:progid:DXImageTransform.Microsoft.Gradient(startColorstr='#CDCDCD', endColorstr='#131313' gradientType='0')}

In the top of my webpage I've put:

<!DOCTYPE HTML>

The output is as follows:

IPB Image

If I then remove the DOCTYPE, I'm getting this result:

IPB Image

And that's how I wan't it to be (as the last example) !

When I'm scrolling down the page, the gradient background stay fixed (read: don't change).

What do I do to solve this issue - I need the DOCTYPE specified to show other things correctly !

Thanks ! cool.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
Christian J
post Apr 2 2012, 08:54 AM
Post #2


.
********

Group: WDG Moderators
Posts: 9,653
Joined: 10-August 06
Member No.: 7



Both screenshots seem to have gradients, just that the first one is smaller. The latter could happen if the BODY height is much larger, which in turn might be affected by the Doctype.

For example, to make a short BODY expand you might use

CODE
body {height: 100%;}


in quirks mode, but in standards mode you need something like

CODE
html, body {height: 100%;}
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Apr 2 2012, 04:54 PM
Post #3


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



That would explain it. I don't see a gradient in the first picture, but I've never been one for nuances. sleep.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th April 2024 - 09:05 AM