css 陰影 效果
CSS中的陰影效果 (Shadow Effects in CSS)
It is always good to make our web pages stylish and beautiful, web pages that would catch users eyes instantly but one gets confused as to how to style his or her web page. The confusion is quite legit too as there is an abundance of styling techniques that one can apply on their web page. Therefore, this section is about one such styling method, that is shadows in CSS.
使我們的網頁時尚美觀,可以立即吸引用戶的眼球,但對于如何設置其網頁樣式卻感到困惑,這總是好事。 混亂也很合法,因為人們可以在其網頁上應用大量的樣式設計技術。 因此,本節將介紹一種這樣的樣式化方法,即CSS中的陰影 。
Using CSS shadow property you can create shadows for text and boxes. Now that we are aware of what this property is, let us discuss some of its properties as well.
使用CSS shadow屬性 ,可以為文本和框創建陰影。 現在我們知道此屬性是什么,讓我們也討論其某些屬性。
文本陰影屬性 (The text-shadow Property)
The very first and quite easy property is text-shadow property. As the name suggests, using text-shadow property you can apply shadows to the text. Making your text smoky and stylish. The values of this property are mentioned below
第一個也是非常容易的屬性是text-shadow屬性 。 顧名思義,可以使用text-shadow屬性將陰影應用于文本。 使您的文字煙熏和時尚 。 該屬性的值在下面提到
text-shadow property can take up to four values to further make the implication easy,
text-shadow屬性最多可以包含四個值,以進一步簡化含義,
Horizontal shadow
水平陰影
Vertical shadow
垂直陰影
Blur effect
模糊效果
Color
顏色
Syntax:
句法:
Element {
text-shadow: 3px 2px 2px #000000;
}
普通文字陰影 (Normal Text Shadow)
The Normal Text Shadow effect helps you add shadow to your text in a very basic method with not that much coding and easy implementing. This could be better understand with the help of an example.
普通文本陰影效果可幫助您以一種非常基本的方法在文本中添加陰影,而無需太多的編碼并且易于實現。 借助示例可以更好地理解這一點。
Example:
例:
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
color: #f40;
text-shadow: 3px 4px 4px #0011f3;
}
</style>
</head>
<body>
<h1>Text-shadow effect!</h1>
</body>
</html>
Output
輸出量
As you can see, in the above example, the normal text-shadow effect is applied and voila!
如您所見,在上面的示例中,將應用普通的文本陰影效果,瞧!
發光的文字效果陰影 (Glowing Text Effect Shadow)
It would be great if we could make our text glow as well. So, why wait and let us move forward with the Glowing text effect shadow property, this property is specifically for making the text to glow.
如果我們還可以使文本發光,那將是很棒的。 因此,為什么要等待并讓我們繼續使用“發光文本效果”陰影屬性,該屬性專門用于使文本發光。
An example can surely help you understand better.
一個例子肯定可以幫助您更好地理解。
Example:
例:
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
color: #f40;
text-shadow: 0 0 4px #00FF9C;
}
</style>
</head>
<body>
<h1>Text-shadow effect!</h1>
</body>
</html>
Output
輸出量
So, you can see, in the above example, the glowing effect text-shadow is applied.
因此,在上面的示例中,您可以看到應用了發光效果text-shadow 。
Box Shadow屬性 (Box Shadow Property)
Next, what if someone wants to apply this property to elements is the HTML? Well, Box Shadow Property has got you covered. This property is used to apply the shadow to elements in CSS. Even further the Box Shadow Property has its own set of values.
接下來,如果有人想將此屬性應用于元素,那就是HTML? 好吧,Box Shadow Property可以滿足您的需求。 此屬性用于將陰影應用于CSS中的元素。 更進一步,Box Shadow屬性具有自己的一組值。
Values:
值:
The box-shadow property can take one to six values,
box-shadow屬性可以采用一到六個值,
inset keyword (it changes the shadow to one inside of the frame)
inset關鍵字(將陰影更改為幀內的一個)
horizontal shadow
水平陰影
vertical shadow
垂直陰影
blur effect
模糊效果
spreading
傳播
color
顏色
Syntax:
句法:
Element {
box-shadow: 10px 10px;
}
Example:
例:
<!DOCTYPE html>
<html>
<head>
<style>
div {
border: 1px solid;
padding: 30px;
box-shadow: 5px 10px 8px 10px #006969;
}
</style>
</head>
<body>
<div>
<p>Box shadow effect.</p>
</div>
</body>
</html>
Output
輸出量
Therefore the above example shows the implementation of box-shadow property which has been applied to the div element.
因此,上面的示例顯示了已應用于div元素的box-shadow屬性的實現。
翻譯自: https://www.includehelp.com/code-snippets/css-shadow-effects.aspx
css 陰影 效果