国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

CSS3 文本效果

CSS3 文本效果

CSS3中包含幾個新的文本特征。

在本章中您將了解以下文本屬性:

  • text-shadow

  • box-shadow

  • text-overflow

  • word-wrap

  • word-break


CSS3的文本陰影

CSS3中,text-shadow屬性適用于文本陰影。

您指定了水平陰影,垂直陰影,模糊的距離,以及陰影的顏色:

實(shí)例

給標(biāo)題添加陰影:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>php中文網(wǎng)(php.cn)</title>
    <style>
        h1
        {
            text-shadow: 5px 5px 5px #FF0000;
        }
    </style>
</head>
<body>
<h1>文本陰影效果!</h1>
</body>
</html>

運(yùn)行程序嘗試一下


CSS3 box-shadow屬性

CSS3中CSS3 box-shadow屬性適用于盒子陰影

實(shí)例

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>php中文網(wǎng)(php.cn)</title>
    <style>
        div
        {
            width:300px;
            height:100px;
            background-color:yellow;
            box-shadow: 10px 10px 5px #ff2332;
        }
    </style>
</head>
<body>
<div>盒子陰影</div>
</body>
</html>

運(yùn)行程序嘗試一下


陰影添加一個模糊效果

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>php中文網(wǎng)(php.cn)</title>
    <style>
        div {
            width: 300px;
            height: 100px;
            padding: 15px;
            background-color: yellow;
            box-shadow: 10px 10px 5px #d93bb3;
        }
    </style>
</head>
<body>
<div>這是一個帶有模糊效果的陰影</div>
</body>
</html>

運(yùn)行程序嘗試一下


CSS3 Text Overflow屬性

CSS3文本溢出屬性指定應(yīng)向用戶如何顯示溢出內(nèi)容

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>php中文網(wǎng)(php.cn)</title> 
<style> 
div.test
{
white-space:nowrap; 
width:12em; 
overflow:hidden; 
border:1px solid #000000;
}
</style>
</head>
<body>
<p>以下 div 容器內(nèi)的文本無法完全顯示,可以看到它被裁剪了。</p>
<p>div 使用 &quot;text-overflow:ellipsis&quot;:</p>
<div class="test" style="text-overflow:ellipsis;">This is some long text that will not fit in the box</div>
<p>div 使用 &quot;text-overflow:clip&quot;:</p>
<div class="test" style="text-overflow:clip;">This is some long text that will not fit in the box</div>
<p>div 使用自定義字符串 &quot;text-overflow: >>&quot;(只在 Firefox 瀏覽器下有效):</p>
<div class="test" style="text-overflow:'>>';">This is some long text that will not fit in the box</div>
</body>
</html>

運(yùn)行程序嘗試一下


CSS3的換行

如果某個單詞太長,不適合在一個區(qū)域內(nèi),它擴(kuò)展到外面:

CSS3中,自動換行屬性允許您強(qiáng)制文本換行 - 即使這意味著分裂它中間的一個字:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>php中文網(wǎng)(php.cn)</title>
<style> 
p.test
{
width:11em; 
border:1px solid #000000;
word-wrap:break-word;
}
</style>
</head>
<body>
<p class="test"> This paragraph contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line.</p>
</body>
</html>

運(yùn)行程序嘗試一下


CSS3 Word Breaking

CSS3 Word Breaking屬性指定換行規(guī)則:

CSS代碼如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>php中文網(wǎng)(php.cn)</title>
<style> 
p.test1
{
width:9em; 
border:1px solid #000000;
word-break:keep-all;
}
p.test2
{
width:9em; 
border:1px solid #000000;
word-break:break-all;
}
</style>
</head>
<body>
<p class="test1"> This paragraph contains some text. This line will-break-at-hyphenates.</p>
<p class="test2"> This paragraph contains some text: The lines will break at any character.</p>
<p><b>注意:</b>  word-break 屬性不兼容 Opera.</p>
</body>
</html>

運(yùn)行程序嘗試一下



繼續(xù)學(xué)習(xí)
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style> div { width: 300px; height: 100px; padding: 15px; background-color: yellow; box-shadow: 10px 10px 5px #d93bb3; } </style> </head> <body> <div>這是一個帶有模糊效果的陰影</div> </body> </html>
提交重置代碼