官术网_书友最值得收藏!

Shadows

Adding shadows to elements and text is simple in CSS3. Use shadows to make certain elements really stand out and give a more natural look to your UI. There are many options for adding shadows, such as size, position, and color. Shadows don't always have to be behind elements and text; they can frame, highlight, and add effects to them too.

Box shadows

In addition to rounded corners, you can add shadows to elements using the new CSS3 box-shadow property. The box-shadow property takes a number of parameters that tells it how to draw the shadow:

box-shadow: h-offset v-offset blur-radius spread-radius color;

Here is an explanation of the parameters:

  • h-offset: The horizontal offset of the shadow. Negative values put the shadow to the left of the element.
  • v-offset: The vertical offset of the shadow. Negative values put the shadow above the element.
  • blur-radius: Determines the blur amount; the higher the number, the more blur (optional).
  • spread-radius: The size of the shadow. If zero, it's the same size as the blur (optional).
  • color: The color of the shadow (optional).
  • inset: Add inset to change shadow from outer to inner (optional).
Note

You can produce some interesting effects other than shadows with the box-shadow property. You can give an element an inner or outer glow by setting the offset values to zero and adjusting the blur and spread (see the previous two examples).

Text shadows

In addition to box shadows, CSS3 has support for text shadows using the text-shadow property. It works nearly identically to box-shadow and uses almost all the same parameters:

text-shadow: h-offset v-offset blur-radius color;

Like box-shadow, you can produce some interesting effects, such as glowing text:

主站蜘蛛池模板: 南安市| 凌云县| 衢州市| 贺兰县| 鄂托克旗| 丹寨县| 肃北| 北海市| 海伦市| 兴国县| 鸡泽县| 金沙县| 伊金霍洛旗| 惠州市| 长葛市| 盐城市| 弥勒县| 潜江市| 洛阳市| 烟台市| 米林县| 蕲春县| 库车县| 固安县| 邵东县| 定西市| 玛纳斯县| 岱山县| 洛阳市| 宝鸡市| 会宁县| 东辽县| 二连浩特市| 黑山县| 嘉义县| 无极县| 墨竹工卡县| 隆子县| 迁安市| 庄河市| 扶余县|