Home Web Front-end CSS Tutorial 《CSS3实战》笔记--渐变设计(三)_经验交流

《CSS3实战》笔记--渐变设计(三)_经验交流

May 19, 2016 pm 02:47 PM
css

IE浏览器引擎的CSS渐变实现方法

IE并不支持CSS渐变,但是提供了渐变滤镜,可以用来实现简单的渐变效果。

基本语法

该参数的参数说明如下:

enabled:设置或检索滤镜是否激活。可选布尔值,包括 true 和 false,默认值为 true ,表示激活状态。

startColor :设置或检索色彩渐变的开始颜色和透明度。可选项,其格式为#AARRGGBB。AA,RR,GG,BB为十六进制正整数,取值范围为00~FF。RR指定红色值,GG指定绿色值,BB指定蓝色值,AA指定透明度,00是完全透明,FF是完全不透明。超出取值范围的值将被恢复为默认值。取值范围为#FF0000~#FFFFFF,默认值为#FF0000FF,即不透明蓝色。

EndColorStr : 设置或检索色彩渐变的结束颜色和透明度。默认值为#FF000000,即不透明黑色。

IE 渐变滤镜实战应用

利用IE滤镜设计渐变背景,然后通过背景图像设计图文插画效果。

代码

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>IE浏览器引擎的CSS渐变实现方法</title>
<style type="text/css">
body {
 padding:1em;/让渐变背景填充整个页面/
 margin:0;
 text-align:center;
 /*为网页设计垂直渐变背景*/
 filter: progid:DXImageTransform.Microsoft.Gradient(gradientType=0, startColorStr=#9999FF, endColorStr=#ffffff);
}
h1 {/*标题样式*/
 color:white;
 font-size:18px;
 height:45px;
 line-height:65px;/*控制文本显示位置*/
 /*以绝地定位方式实现块元素居中显示*/
 position:absolute;
 left:50%;
 margin-left:-150px;
 padding-left:50px;
 border-bottom:solid 2px #c72223;
 /*为标题插入一个装饰图标*/
 background:url(images/icon4.png) no-repeat left center;
}
ul {/*列表框样式*/
 /*清除列表默认样式*/
 list-style-type:none;
 margin:90px 0 0 0;
 padding:0;
 background:url(images/bg6.png) no-repeat right bottom;/*设计插图背景*/
 clear:both;
 text-align:left;/*恢复默认对齐方式*/
}
li {
 line-height:1.5em;
 margin:6px auto;
 /*为列表项设计个性化的列表图标*/
 font-size:14px;
 background:url(images/icon3.png) no-repeat left 3px;
 padding-left:20px;
}
</style>
</head>

<body>
<h1>喜欢是一种心情,爱是一种感受</h1>
<ul>
 <li>有一种爱叫痴缠,比如很多人对张国荣的,有时候这样真的挺好,没有比爱一个故人更安全和永恒的了。</li>
 <li>有一种爱叫迷恋,某一时间里,忽然发现自己迷上某个人或某种感觉,但那不会长久。有时候迷恋会转化成爱。</li>
 <li>爱里面一定有迷恋、有喜欢。可迷恋、喜欢都不是爱。</li>
 <li>当自己终于明白什么是爱的时候,往往生命去了大半。人生路上能遇上一个真正爱自己的人,是机缘。</li>
 <li>有时候,爱是一瞬间的感觉,爱并不能长久保留,如果两人经营得好才会长久保留下去。爱同时是脆弱的,爱会破碎。</li>
 <li>有时候,爱是一种心愿,一种可以让自己与对方更快乐的心情。一份美好的爱必定离不开包容。</li>
 <li>有时候,爱是一种自然。花开花落,云卷云舒的一点没有强求。</li>
 <li>当能够以一种平淡的心情看待感情时,爱便变得隽永。</li>
 <li>爱情有时候让人变得很苛刻,但后来又会很包容。当爱对方超过爱自己,那爱就会很包容。</li>
 <li>喜欢一个人不会对他很苛刻,因为喜欢不会有更多的要求。相反爱却是苛刻的。</li>
 <li>喜欢一个人不会为她很心痛,爱却往往是很心痛。爱是一种归属,喜欢没有归属。</li>
 <li>在喜欢与爱的边缘徘徊的人,如果尝试着离开很远,还能在某个深夜静静地想起他,想到心痛与流泪,那一定是爱了。</li>
 <li>在爱上之前可能有很长的喜欢,有时喜欢就能转化成爱,有时喜欢也会淡掉。原来人与人都是平行线上的一些点,檫肩而过很平常,向左转,向右转,下一个路口,还会有新的风景。</li>
 <li>有时候喜欢会带来遗憾,但爱情会带来伤害。这种伤害最后会变成对对方一生的祝福。但喜欢就会越来越淡,最后在心里留下一个淡漠的影子。爱比喜欢要有力量。</li>
</ul>
</body>
</html>

演示效果:

这里写图片描述

W3C标准化的CSS渐变实现方法

25个渐变背景网页设计案例欣赏

标准草案沿袭Gecko引擎的渐变设计方法:http://dev.w3.org/csswg/css3-images/#gradients

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use PHP to build social sharing functions PHP sharing interface integration practice How to use PHP to build social sharing functions PHP sharing interface integration practice Jul 25, 2025 pm 08:51 PM

The core method of building social sharing functions in PHP is to dynamically generate sharing links that meet the requirements of each platform. 1. First get the current page or specified URL and article information; 2. Use urlencode to encode the parameters; 3. Splice and generate sharing links according to the protocols of each platform; 4. Display links on the front end for users to click and share; 5. Dynamically generate OG tags on the page to optimize sharing content display; 6. Be sure to escape user input to prevent XSS attacks. This method does not require complex authentication, has low maintenance costs, and is suitable for most content sharing needs.

PHP creates a blog comment system to monetize PHP comment review and anti-brush strategy PHP creates a blog comment system to monetize PHP comment review and anti-brush strategy Jul 25, 2025 pm 08:27 PM

1. Maximizing the commercial value of the comment system requires combining native advertising precise delivery, user paid value-added services (such as uploading pictures, top-up comments), influence incentive mechanism based on comment quality, and compliance anonymous data insight monetization; 2. The audit strategy should adopt a combination of pre-audit dynamic keyword filtering and user reporting mechanisms, supplemented by comment quality rating to achieve content hierarchical exposure; 3. Anti-brushing requires the construction of multi-layer defense: reCAPTCHAv3 sensorless verification, Honeypot honeypot field recognition robot, IP and timestamp frequency limit prevents watering, and content pattern recognition marks suspicious comments, and continuously iterate to deal with attacks.

How to use PHP to develop a Q&A community platform Detailed explanation of PHP interactive community monetization model How to use PHP to develop a Q&A community platform Detailed explanation of PHP interactive community monetization model Jul 23, 2025 pm 07:21 PM

1. The first choice for the Laravel MySQL Vue/React combination in the PHP development question and answer community is the first choice for Laravel MySQL Vue/React combination, due to its maturity in the ecosystem and high development efficiency; 2. High performance requires dependence on cache (Redis), database optimization, CDN and asynchronous queues; 3. Security must be done with input filtering, CSRF protection, HTTPS, password encryption and permission control; 4. Money optional advertising, member subscription, rewards, commissions, knowledge payment and other models, the core is to match community tone and user needs.

What is the purpose of the CSS `will-change` property? What is the purpose of the CSS `will-change` property? Jul 23, 2025 am 03:47 AM

will-change is a CSS property that is used to inform browser elements in advance of possible changes to optimize performance. Its core function is to enable the browser to create layers in advance to improve rendering efficiency. Common values include transform, opacity, etc., and can also be separated by multiple attribute commas; it is suitable for non-standard attribute animations, complex component transitions and user interaction triggered animations; but it must be avoided abuse, otherwise it will lead to excessive memory usage or increased GPU load; the best practice is to apply before the change occurs and remove it after it is completed.

Free entrance to Vue finished product resources website. Complete Vue finished product is permanently viewed online Free entrance to Vue finished product resources website. Complete Vue finished product is permanently viewed online Jul 23, 2025 pm 12:39 PM

This article has selected a series of top-level finished product resource websites for Vue developers and learners. Through these platforms, you can browse, learn, and even reuse massive high-quality Vue complete projects online for free, thereby quickly improving your development skills and project practice capabilities.

What are common CSS browser inconsistencies? What are common CSS browser inconsistencies? Jul 26, 2025 am 07:04 AM

Different browsers have differences in CSS parsing, resulting in inconsistent display effects, mainly including the default style difference, box model calculation method, Flexbox and Grid layout support level, and inconsistent behavior of certain CSS attributes. 1. The default style processing is inconsistent. The solution is to use CSSReset or Normalize.css to unify the initial style; 2. The box model calculation method of the old version of IE is different. It is recommended to use box-sizing:border-box in a unified manner; 3. Flexbox and Grid perform differently in edge cases or in old versions. More tests and use Autoprefixer; 4. Some CSS attribute behaviors are inconsistent. CanIuse must be consulted and downgraded.

Describe the structure of a CSS rule set Describe the structure of a CSS rule set Jul 20, 2025 am 02:49 AM

The CSS rule set consists of selectors and declaration blocks to define the style of HTML elements. 1. The selector specifies the target element, such as a tag, class, or ID; 2. Declare the block to contain attributes and values to control the appearance of the element. For example: p{color:blue;font-size:16px;} means selecting the paragraph and setting the text color and font size. Master these two parts to write effective CSS styles.

How to build a PHP Nginx environment with MacOS to configure the combination of Nginx and PHP services How to build a PHP Nginx environment with MacOS to configure the combination of Nginx and PHP services Jul 25, 2025 pm 08:24 PM

The core role of Homebrew in the construction of Mac environment is to simplify software installation and management. 1. Homebrew automatically handles dependencies and encapsulates complex compilation and installation processes into simple commands; 2. Provides a unified software package ecosystem to ensure the standardization of software installation location and configuration; 3. Integrates service management functions, and can easily start and stop services through brewservices; 4. Convenient software upgrade and maintenance, and improves system security and functionality.

See all articles