CSS Filter (webpage gray, image gradient)

Source: Internet
Author: User
Tags transparent image
  • commemorative 512, enabling black and white pages , you can set the following Code :

    code highlighting produced by actipro codehighlighter (freeware)
    http://www.CodeHighlighter.com/

    --> body
    {
    filter : progid: DXImageTransform. microsoft. basicimage (grayscale = 1) ;
    }

  • For imgGradientControl by using JavaScript:

InWhen browsing, the page displays an almost transparent image. When you move the mouse over the image, the image gradually becomes clearer. When you move the mouse away, the image is restored to the original transparent State. To implement this function, you need to use the Alpha filter of CSS and use JavaScript to control the opacity value of the Alpha filter. First, insert an image into the webpage and set the opacity value of the Alpha filter, make the image transparent and add onmouseover and onmouseout actions to the image.

JavaScript code
Function Cssfilter (N)
{
If (N = " Add " ) // If the input parameter is add, the opacity of the image is increased.
If (IMG. Filters. Alpha. Opacity <   100 )
{
IMG. Filters. Alpha. Opacity + =   5 ;
SetTimeout ( " Cssfilter ('add ') " , 20 );
}
If (N = " Dec " ) // If the input parameter is Dec, the opacity of the image is reduced.
If (IMG. Filters. Alpha. Opacity >   20 )
{
IMG. Filters. Alpha. Opacity -=   5 ;
SetTimeout ( " Cssfilter ('dec ') " , 20 );
}
}

 

Foreground image HTML:

< IMG SRC = "Here is the image path" ID = "IMG" Style = "Filter: alpha (opacity = 20 )"  
Onmouseover = "Cssfilter ('add ')" Onmouseout = "Cssfilter ('dec ')"   />

 

// Reprinted the following content:

Share the following information:

CSS addition:Html{Filter:Progid: DXImageTransform. Microsoft. basicimage (grayscale = 1);}

Or:Html{Filter: Gray}

You can add it to the webpage, but the page is too large to be changed and CSS is convenient.

 
<Style.Type="Text/CSS">Html{Filter: Gray} </Style>

Sometimes it may not take effect because the website does not use the latest standard webpage protocol.

Add the following to the page:

 
<! Doctype HTML public"-// W3C // dtd xhtml 1.0 transitional // en""Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns ="Http://www.w3.org/1999/xhtml">

The color of the Flash animation on the website cannot be controlled by the CSS Filter. You need to <object…> And </Object>:

<ParamValue="False"Name ="Menu"/> <ParamValue="Opaque"Name ="Wmode"/>

Basically, success... Http://www.cnblogs.com/sun8134/archive/2010/04/21/1716794.html

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.