您的位置:首页 > Web前端 > CSS

CSS3 笔记三(Shadow/Text/Web Fonts)

2016-01-01 13:37 567 查看
CSS3 Shadow Effects

text-shadow


box-shadow


1> text-shadow

The text-shadow property adds shadow to text.

This property accepts a comma-separated list of shadows to be applied to the text.

syntax

text-shadow: h-shadow v-shadow blur-radius color|none|initial|inherit;


Values

ValueDescription

h-shadowRequired. The position of the horizontal shadow. Negative values are allowed
v-shadowRequired. The position of the vertical shadow. Negative values are allowed
blur-radiusOptional. The blur radius. Default value is 0
colorOptional. The color of the shadow. Look at CSS Color Values for a complete list of possible color values
noneDefault value. No shadow
initialSets this property to its default value.
inheritInherits this property from its parent element.
Example

h2 {
text-shadow: 0 0 3px #FF0000;
}
h1 {
color: white;
text-shadow: 1px 1px 2px black, 0 0 25px blue, 0 0 5px darkblue;
}


2> box-shadow

The box-shadow property attaches one or more shadows to an element

box-shadow: none|h-shadow v-shadow blur spread color |inset|initial|inherit;


Values

ValueDescription
noneDefault value. No shadow is displayed
h-shadowRequired. The position of the horizontal shadow. Negative values are allowed
v-shadowRequired. The position of the vertical shadow. Negative values are allowed
blurOptional. The blur distance
spreadOptional. The size of shadow. Negative values are allowed
colorOptional. The color of the shadow. The default value is black.
insetOptional. Changes the shadow from an outer shadow (outset) to an inner shadow
initialSets this property to its default value.
inheritInherits this property from its parent element.
Example

div {
box-shadow: 10px 10px 5px grey;
}


text-shadow demos

CSS3 Text

text-overflow


word-wrap


word-break


1> Text-overflow


text-overflow: clip|ellipsis|string|initial|inherit;


Values

ValueDescription
clipDefault value. Clips the text
ellipsisRender an ellipsis ("...") to represent clipped text
stringRender the given string to represent clipped text
initialSets this property to its default value.
inheritInherits this property from its parent element
2> word-wrap

The word-wrap property allows long words to be able to be broken and wrap onto the next line.

syntax

word-wrap: normal|break-word|initial|inherit;


ValueDescription
normalBreak words only at allowed break points
break-wordAllows unbreakable words to be broken
3> word-break

The word-break property specifies line breaking rules for non-CJK scripts.

syntax

word-break: normal|break-all|keep-all|initial|inherit;q


ValueDescription
normalDefault value. Break words according to their usual rules
break-allLines may break between any two letters
keep-all Breaks are prohibited between pairs of letters
Web Fonts

Web fonts allow Web designers to use fonts that are not installed on the user's computer.

When you have found/bought the font you wish to use, just include the font file on your web server, and it will be automatically downloaded to the user when needed.

Your "own" fonts are defined within the CSS3
@font-face
rule.

Different Font Formats

1> TrueType Fonts (TTF)
2> OpenType Fonts (OTF)
3> The Web Open Font Format (WOFF)
4> The Web Open Font Format (WOFF 2.0)
5> SVG Fonts/Shapes
6> Embedded OpenType Fonts (EOT)


Example

@font-face {
font-family: myFirstFont;
src: url(sansation_light.woff);
}

div {
font-family: myFirstFont;
}


Tip: Always use lowercase letters for the font URL. Uppercase letters can give unexpected results in IE.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: