css模糊
Introduction:
介紹:
Sometimes even the professional developers tend to forget the various basic properties which can be applied to solve very simple problems, therefore the fundamentals of developing a website or web page should be very clear and must be practiced thoroughly. This section is all about one such property which is used to deal with the most-used element on a website or web page.
有時,即使是專業的開發人員也往往會忘記可用于解決非常簡單的問題的各種基本屬性,因此開發網站或網頁的基礎應該非常清楚,并且必須徹底地實踐。 本節全部關于一個此類屬性,該屬性用于處理網站或網頁上最常用的元素。
Trivia:
瑣事:
Images are very interesting elements on any web page or website but to deal with them is equally critical and important as well. Images enhance the appearance of the web page or website, besides images attract many users and any user would love to see some images while visiting any website or web page. Images are used for reference for some piece of information, besides the images can be used to give a clear picture of what is being said in an article, blog, etc. Therefore to deal with such fundamental elements is of paramount importance. This section is about one such property which is widely used while dealing with the images, which is known as blur property in CSS.
圖像在任何網頁或網站上都是非常有趣的元素,但是處理它們同樣至關重要,也很重要。 圖像增強了網頁或網站的外觀,圖像吸引了許多用戶,并且任何用戶都希望在訪問任何網站或網頁時看到一些圖像。 圖像可用于某些信息的參考,此外圖像還可用于清晰地顯示文章,博客等中所說的內容。因此,處理此類基本元素至關重要。 本節是關于在處理圖像時廣泛使用的此類屬性, 在CSS中稱為模糊屬性 。
Let us move forward and have a look at the definition below,
讓我們繼續前進,看看下面的定義,
Definition:
定義:
Since by looking at the name of the property it is quite obvious to know that what is the purpose of this property.
因為通過查看屬性的名稱,很明顯知道該屬性的目的是什么。
When the user needs to blur a specific image then this blur CSS property comes into play. The filter property is used to convert any image into a blurred image. Very basic property and very easy to implement. This property is used widely and proves to be of utmost importance to make a website or web page responsive.
當用戶需要模糊特定的圖像時,該模糊CSS屬性就會起作用。 filter屬性用于將任何圖像轉換為模糊圖像 。 非常基本的屬性,非常容易實現。 此屬性被廣泛使用,并被證明對于使網站或網頁具有響應能力至關重要。
Syntax:
句法:
Element{
filter:blur();
}
Where the user can specify the intensity of the blur effect that is used to blur the image.
用戶可以在其中指定用于模糊圖像的模糊效果的強度。
Example:
例:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
img {
filter: blur(4px);
}
</style>
</head>
<body>
<p>Apply a blur effect to the image below:</p>
<img src="img_forest.jpg" width="300" height="300">
</body>
</html>
Output
輸出量
It is very clear by looking at the result of the example above that the image of the forest is blurred with 4px intensity.
通過查看以上示例的結果可以很清楚地看到,森林的圖像以4px的強度模糊 。
Note: To use this property, you must ensure that you are using the value filter and then followed by the property blur(), otherwise the property would be rendered useless.
注意:要使用此屬性,必須確保使用的是值過濾器 ,然后使用屬性blur() ,否則該屬性將變為無用。
Closing tips:
結束提示:
Since the property is very easy to implement and to understand but one must be very careful while using the blur property in CSS as this property can not be used on every image because if you make a relevant image as a blur then the user would not be able to see the content of that image.
由于該屬性非常容易實現和理解,但是在CSS中使用blur屬性時必須非常小心,因為此屬性不能在所有圖像上使用,因為如果將相關圖像作為模糊對象,則用戶不會能夠看到該圖像的內容。
翻譯自: https://www.includehelp.com/code-snippets/how-to-blur-an-image-using-css.aspx
css模糊