css img不透明度如何设置


当前第2页 返回上一页

源代码是这样的:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

<!DOCTYPE html>

<html>

<head>

<style>

div.background

{

  width: 400px;

  height: 266px;

  background: url('/i/tulip_peach_blossom_w.jpg') no-repeat;

  border: 1px solid black;

}

div.transbox

{

  width: 338px;

  height: 204px;

  margin:30px;

  background-color: #ffffff;

  border: 1px solid black;

  /* for IE */

  filter:alpha(opacity=60);

  /* CSS3 standard */

  opacity:0.6;

}

div.transbox p

{

  margin: 30px 40px;

}

</style>

</head>

<body>

<div class="background">

<div class="transbox">

<p>

This is some text that is placed in the transparent box.

This is some text that is placed in the transparent box.

This is some text that is placed in the transparent box.

This is some text that is placed in the transparent box.

This is some text that is placed in the transparent box.

</p>

</div>

</div>

</body>

</html>

首先,我们创建一个 div 元素 (class="background"),它有固定的高度和宽度、背景图像,以及边框。然后我们在第一个 div 内创建稍小的 div (class="transbox")。"transbox" div 有固定的宽度、背景色和边框 - 并且它是透明的。在透明 div 内部,我们在 p 元素中加入了一些文本。

以上就是css img不透明度如何设置的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

css column-fill属性怎么用

js如何设置css

css 层叠是什么

css怎么不选最后一个元素

css如何设置图片不重复拉伸

html代码如何让照片变模糊

css怎么设置文本框宽度

如何让css hover 失效

css怎么样清除浮动

css 中伪类的使用(干货)

更多相关阅读请进入《css》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...

    暂无评论...