css背景图片高斯模糊

Well, you have now seen the syntax of CSS and are now comfortable with writing CSS rules using class and id selectors. Moving on, we now dive into backgrounds in CSS and it's time to ditch the old black and white theme and have beautiful, bright designs.

好了,您现在已经了解了CSS的语法,现在可以轻松地使用classid选择器编写CSS规则。 继续,我们现在进入CSS背景,现在该抛弃旧的黑白主题,并拥有漂亮,明亮的设计。

The background property is one of the most useful ones and really fun to play around with. It is used to manipulate page backgrounds as we shall soon see.

background属性是最有用的属性之一,并且非常有趣。 我们将很快看到,它用于操纵页面背景。

背景色- background-color (Background Color - background-color)

color in CSS world, can be specified in the following three ways:

CSS世界中的color ,可以通过以下三种方式指定:

  • using a valid color name, like red

    使用有效的颜色名称,例如red

  • using an RGB value, like rgb(255, 255, 255)

    使用RGB值,例如rgb(255, 255, 255)

  • or, by using the Hexa code for the color, like #F9F9F9 (There are many websites to check hexa codes for colors, like ColorHexa)

    或者,通过使用十六进制代码表示颜色,例如#F9F9F9 (有很多网站检查十六进制代码以显示颜色,例如ColorHexa )

Coming back to background-color, this property sets an element's background color. The default value, transparent allows any underlying content to show through. A value of inherit applies the value of the property from a containing parent element.

回到background-color ,此属性设置元素的背景色。 默认值transparent允许任何基础内容显示出来。 inherit值适用于包含父元素的属性值。

background-color: color | transparent | inherit

For example,

例如,

h1 { background-color: red; }p { background-color: orange; }

Live Example →

现场示例→

The above example, will set background color as red for all the h1 headings and background color as orange for all the paragraphs.

上面的示例将所有h1标题的背景色设置为red ,并将所有段落的背景色设置为orange

This is compatible with CSS1, CSS2 and CSS3 along with following Web Browsers,

它与CSS1CSS2CSS3以及以下Web浏览器兼容,

  • IE 4+

    IE 4+

  • Firefox 1+

    Firefox 1+

  • Opera 4+

    歌剧4+

  • Safari 1+

    Safari 1+

背景图片- background-image (Background Image - background-image)

As the name suggests, background-image associates an image with an element. The background image requires a URL to the source image specified with the url() syntax. The default value is none.

顾名思义, background-image将图像与元素相关联。 背景图像需要使用url()语法指定的源图像的url() 。 默认值为none

background-image: url(image-file) | none | inherit

Consider the below example, this will set a background image for the complete webpage.

考虑以下示例,这将为整个网页设置背景图像。

body { background-image: url(tile.png)
}

To set background image, for any particular element/tag, use class or id to do so,

要设置背景图片,对于任何特定的元素/标签,请使用classid进行设置,

#hello { background-image: url(http://www.example.com/images/hello.gif);
}

Live Example →

现场示例→

The value of url can be a complete web URL or a relative URL. For example, you can simply specify the name of the picture, if it is present in the same directory.

url的值可以是完整的Web URL或相对URL。 例如,您可以简单地指定图片的名称(如果图片位于同一目录中)。

This is compatible with CSS1, CSS2 and CSS3 along with following Web Browsers,

它与CSS1CSS2CSS3以及以下Web浏览器兼容,

  • IE 4+

    IE 4+

  • Firefox 1+

    Firefox 1+

  • Opera 4+

    歌剧4+

  • Safari 1+

    Safari 1+

NOTE: One important point to remember while setting backgrounds is, always choose a background that complements the text on it, so that the text is clearly visible.

注意:设置背景时要记住的重要一点是,请始终选择与背景文字互补的背景,以使文字清晰可见。

重复背景- background-repeat (Repeat Background - background-repeat)

Sometimes, it may so happen that the background image that you choose for your webpage may be smaller than the canvas space that is used by other elements on the page. In such a situation, you may want to repeat the image. The values for this property can be following:

有时,您为网页选择的背景图像可能小于页面上其他元素使用的画布空间。 在这种情况下,您可能需要重复图像。 此属性的值可以如下:

  • repeat - repeats image both vertically and horizontally. This is the default value for background-repeat property.

    repeat -垂直和水平重复图像。 这是background-repeat属性的默认值。

  • repeat-x - repeats only horizontally

    repeat-x仅水平重复

  • repeat-y - repeats vertically

    repeat-y垂直重复

  • no-repeat - doesn't repeat the background image.

    no-repeat -不重复背景图片。

Example:

例:

body{ background-image: url(studytonight.png);background-repeat: no-repeat;
}

Live Example →

现场示例→

The above code will make the image studytonight.png as the webpage background, but if the size of the image is smaller, it will not completely fill the webpage, and as the background-repeat property is set to no-repeat, hence it won't be repeated, leaving some area with no background.

上面的代码会将图像studytonight.png用作网页背景,但是如果图像的尺寸较小,则不会完全填满网页,并且由于background-repeat属性设置为no-repeat ,因此它赢得了不再重复,留下一些没有背景的区域。

This is compatible with CSS1, CSS2 and CSS3 along with following Web Browsers,

它与CSS1CSS2CSS3以及以下Web浏览器兼容,

  • IE 4+

    IE 4+

  • Firefox 1+

    Firefox 1+

  • Opera 4+

    歌剧4+

  • Safari 1+

    Safari 1+

背景位置- background-position (Background Position - background-position)

By default a background image is positioned at the top left corner of the webpage, but we can change that.

默认情况下,背景图像被放置在网页的左上角 ,但我们可以改变这种状况。

This property determines how a background image is positioned. The position of the background image from the top left corner can be specified in terms of absolute distance(in pixels), or it can also be specified as a percentage value.

此属性确定如何定位背景图像。 左上角的背景图像的位置可以以绝对距离(以像素为单位)指定,也可以指定为百分比值。

The named values can also be used while determining the position. The horizontal axis names are center, left and right. The vertical axis, as you might have guessed, top, center and bottom. Consider the following examples:

确定位置时也可以使用命名值。 水平轴名称为中心左侧右侧 。 您可能已经猜到了垂直轴topcenterbottom 。 请考虑以下示例:

body { background-image: url(hello.png); background-position: 100px 150px;
}
body { background-image: url(hello.png); background-position: 10% 55%;
}
body { background-image: url(hello.png); background-position: top center;
}

Try this by adding background-position: top right; to #study style in the last live example.

通过添加 background-position: top right;尝试 background-position: top right; 在最后一个实时示例中 #study#study样式。

When we specify background-position in pixels or percentage, we specify 2 values, first value specifes distance from the left side, and the second value specifies the distance from the top.

当我们以像素百分比单位指定background-position时,我们指定2个值,第一个值指定距左侧的距离,第二个值指定距顶部的距离。

This is compatible with CSS1, CSS2 and CSS3 along with following Web Browsers,

它与CSS1CSS2CSS3以及以下Web浏览器兼容,

  • IE 4+

    IE 4+

  • Firefox 1+

    Firefox 1+

  • Opera 4+

    歌剧4+

  • Safari 1+

    Safari 1+

背景行为- background-attachment (Background Behaviour - background-attachment)

This property sets, whether the background image will scroll or not. The default value is scroll, which sets the background to scroll with the associated content, typically text. The alternate value, fixed, makes the background static while associated content scrolls over the background.

此属性设置背景图像是否滚动。 默认值为scroll ,它将背景设置为与相关内容(通常为文本)一起滚动。 备用值fixed可以使背景静止,而相关内容在背景上滚动。

A value of inherit applies the value of the property from a containing parent element.

inherit值适用于包含父元素的属性值。

background-attachment: scroll | fixed | inherit

Consider the following example,

考虑以下示例,

body{ background-image: url (hello.png); background-repeat: no-repeat;background-position: right top;background-attachment: fixed; }

This is compatible with CSS1, CSS2 and CSS3 along with following Web Browsers,

它与CSS1CSS2CSS3以及以下Web浏览器兼容,

  • IE 4+

    IE 4+

  • Firefox 1+

    Firefox 1+

  • Opera 4+

    歌剧4+

  • Safari 1+

    Safari 1+

Note: This property is often used to create a watermark effect similar to the proprietary attribute of the tag, bgproperties, introduced by Microsoft.注意:此属性通常用于创建水印效果,类似于Microsoft引入的标记的专有属性bgproperties。

背景属性一起 (Background Properties together)

If we want, we can combine all the above background properties in a single property.

如果需要,可以将所有上述背景属性组合为一个属性。

The order of the properties should not matter and any property that you don't define use their own default values. Consider the following examples:

属性的顺序无关紧要,并且您未定义的任何属性都使用其自己的默认值。 请考虑以下示例:

body { background: white url(picture.gif) repeat-y center; }

翻译自: https://www.studytonight.com/cascading-style-sheet/css-backgrounds

css背景图片高斯模糊

css背景图片高斯模糊_CSS背景相关推荐

  1. 背景图片固定(背景图片附着)(HTML、CSS)

    背景图片固定(背景图片附着)(HTML.CSS) <!DOCTYPE html> <html lang="en"><head><meta ...

  2. html如何将图片弄成背景,如何用css把图片弄成背景

    用css把图片弄成背景的方法:首先创建一个HTML示例文件:然后在body中添加一些p标签:最后使用css中的background属性将图片设置为背景即可. 本教程操作环境:Windows7系统.cs ...

  3. CSS的背景(背景颜色,背景图片,背景平铺,背景图片位置,背景图片固定(图片附着),背景复合写法)

    CSS的背景 通过 CSS 背景属性,可以给页面元素添加背景样式. 背景属性可以设置背景颜色.背景图片.背景平铺.背景图片位置.背景图像固定等. 背景颜色 background-color 定义元素的 ...

  4. Css的背景(背景颜色、背景图片、背景平铺、背景图片位置、背景图像固定)

    通过css背景属性,可以给页面元素添加背景样式. 背景属性可以设置背景颜色.背景图片.背景平铺.背景图片位置.背景图像固定等. 背景颜色: Background-color:#******: < ...

  5. 黑马程序员前端-CSS背景:颜色、图片、平铺、背景图片位置、背景图像

    前端学习笔记教程不定期更新中,传送门: 前端HTML第一天:什么是网页?什么是HTML?网页怎么形成? 黑马程序员前端-CSS入门总结 黑马程序员前端-CSS之emmet语法 黑马程序员前端-CSS的 ...

  6. css背景图片加上半透明背景颜色

    背景图片加上半透明背景颜色 background: rgba(0, 0, 0, .6) url(../../images/pro-bg.png) no-repeat center center; 转载 ...

  7. background图片叠加_CSS 背景图片重叠铺满整个层

    background:url(背景图片路径) no-repeat;/*不重复默认在左上方*/ background:url(背景图片路径) no-repeat center;/*不重复背景图片中间显示 ...

  8. android取消背景图片,android 设置背景图片

    >**无背景的代码稍显枯燥啊少年: vs2015,vs2019等 再拓展里下载:** ! import java.awt.FlowLayout; import javax.swing.Image ...

  9. 怎么修改计算机密码界面的背景,怎么修改Win7登录界面背景图片(欢迎界面背景图片)?...

    怎么修改Win7登录界面背景图片(欢迎界面背景图片)?之前自己曾设置过,当时没有想到分享给朋友们!现在把这个帖子补上,先来看下效果图片,笔者将其换成了苹果Mac的登陆界面!只要您能从中获得乐趣,其实这 ...

最新文章

  1. Ubuntu输入正确的用户名密码不能进入系统的原因和解决方法
  2. fzu1062 洗牌问题(思路模拟)
  3. ES6基础2(块级作用域、数组对象解构)-学习笔记
  4. java实现时钟方法汇总
  5. Javascript创建对象几种方法解析
  6. 计算机通信网填空题答案 与rs232接口相比,x.21接口,2020年自考计算机网络与通信问答题及答案:第三章...
  7. gini系数 决策树_决策树原理,机器学习系列
  8. priority_queue用法
  9. R语言入门:R、R Studio的安装配置【多图详解、保姆级教程】
  10. NewLand手持设备上条码扫描
  11. kafka消息堆积及分区不均匀的解决方案
  12. mysql中year函数算年龄_MySQL中的YEAR函数
  13. LTE上行物理层传输机制(6)-周期CQI、PMI和RI的发送时机
  14. 全站替换https攻略
  15. C语言进程——进程间的通信方式
  16. C语言多线程基础入门
  17. 大数据 智能交通调度_大数据时代下的智能交通
  18. 在JavaScript中每5秒调用一个函数
  19. python办公自动化系列之金蝶K3自动登录(二)
  20. 网页登录邮箱如何恢复误删邮件?

热门文章

  1. SSM实战系列之商城系统(前端+后台)《一》项目需求分析
  2. 网络系统安全课程设计
  3. 黄执中:我阅人无数,发现30岁混得好的都有同一种特质
  4. 将服务器设置成路由器
  5. 如何将vue项目打包在服务器上运行
  6. 代码发芽网:无需插件支持Blog代码高亮,支持近百种编程语言
  7. mysqli mysql assoc_在预准备语句上使用fetch_assoc(php mysqli)
  8. 面试python的理解_面试宝典:深入理解这110道python面试题,AI和大数据向你招手,下...
  9. 关于电工产品的执行标准与认证
  10. python串口类_Python中serial的使用