简体   繁体   中英

Css left side of a div brighter?

I have a div which is a wrapper of my half website and on the left side there's a category list. The wrapper itself is in grey color.

What I want is that it would switch from grey color to white. Here's an example image how I'd like it to be:

在此输入图像描述

Is there a solution to this?

EDIT

If it will be of any help here's my wrapper's css:

#wrapper{
width: 980px;
margin: 0 auto;
background: #f3f3f3;
}

If I understand you correctly, you're looking for a way to add a gradient. Below you find the CSS for a gradient going from left to right with the colors #FFFFFF to #F3F3F3 .

Please be aware, that gradients haven't been standardized yet, and many browsers have their own implementiation. This is why there are multiple directives (prefixed -o- for Opera, -moz- for Mozilla, etc.):

#wrapper {
    ...
    background-image: 
        linear-gradient(left , rgb(255,255,255) 35%, rgb(243,243,243) 84%);
    background-image: 
        -o-linear-gradient(left , rgb(255,255,255) 35%, rgb(243,243,243) 84%);
    background-image: 
        -moz-linear-gradient(left , rgb(255,255,255) 35%, rgb(243,243,243) 84%);
    background-image: 
        -webkit-linear-gradient(left , rgb(255,255,255) 35%, rgb(243,243,243) 84%);
    background-image: 
        -ms-linear-gradient(left , rgb(255,255,255) 35%, rgb(243,243,243) 84%);

    background-image: -webkit-gradient(
        linear,
        left top,
        right top,
        color-stop(0.35, rgb(255,255,255)),
        color-stop(0.84, rgb(243,243,243))
    );
}

Here's a convenient CSS Gradient Generator

What you need are gradients.
Try this generator or just read about them

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM