English 中文(简体)
我如何创造半透明的背景?
原标题:How do I make a semi transparent background?
  • 时间:2011-01-25 06:20:06
  •  标签:
  • css

I need to make a white background 50% transparent without affecting anything else. How do I do it?

最佳回答

使用rgba():

.transparent {
  background-color: rgba(255,255,255,0.5);
}

这将给你50%的不透明性,而箱子的内容将继续有100%的不透明性。

如果您使用<代码>opacity:0.5,内容和背景都将被删除。 因此没有使用。

问题回答

这种做法行之有效,但这一类要素的所有子女也将变得透明,没有任何预防办法。

.css-class-name {
    opacity:0.8;
}

如果你想要创造透明的背景,那么插头会尝试:

   .transparent{
       background:rgba(1,1,1,0.5);
   }

www.un.org/Depts/DGACM/index_spanish.htm 了解

Some web browsers have difficulty to render text with shadows on top of transparent background. Then you can use a semi transparent 1x1 PNG image as a background.

<><>>>>>

认定IE6不支持PNG档案。

DO NOT use a 1x1 semi transparent PNG. Size the PNG up to 10x10, 100x100, etc. Whatever makes sense on your page. (I used a 200x200 PNG and it was only 0.25 kb, so there s no real concern over file size here.)

在访问这一职位后,我创建了我的网页,有3,1x1个有不同透明度的PNG。

玛莎维埃·科普5号轮船正在装上。 我正在向监督事务司发回! 很显然,在我试图施展、插入文字、基本上做任何事情的时候,德国妇女局试图在......的时候再重载半透明地区1x1 pixel。 YIKES!

阿德森技术支助甚至不知道问题是什么,但告诉我重建档案(有时在系统工作)。 只是在我把第一个透明的国家政府装进了卷宗时,事实再次深入。

然后,我在另一个帮助点发现一个PNGs坠毁的哨所。 实现全国人民代表大会的目标;这样做毫无结果。

虽然时间已经过去,但不能普遍使用对座标的回答。 利用“金巴”制造透明的彩色面罩——这并没有确切地解释如何用背景图像来做到这一点。

我的解决办法针对背景图象或肤色背景。

#parent {
    font-family:  Open Sans Condensed , sans-serif;
    font-size: 19px;
    text-transform: uppercase;
    border-radius: 50%;
    margin: 20px auto;
    width: 125px;
    height: 125px;
    background-color: #476172;
    background-image: url( https://unsplash.it/200/300/?random );
    line-height: 29px;
    text-align:center;
}

#content {
    color: white;
    height: 125px !important;
    width: 125px !important;
    display: table-cell;
    border-radius: 50%;
    vertical-align: middle;
    background: rgba(0,0,0, .3);
}
<h1 id="parent"><a href="" id="content" title="content" rel="home">Example</a></h1>
div.main{
     width:100%;
     height:550px;
     background: url( https://images.unsplash.com/photo-1503135935062-
     b7d1f5a0690f?ixlib=rb-enter code here0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=cf4d0c234ecaecd14f51a2343cc89b6c&dpr=1&auto=format&fit=crop&w=376&h=564&q=60&cs=tinysrgb ) no-repeat;
     background-position:center;
     background-size:cover 
}
 div.main>div{
     width:100px;
     height:320px;
     background:transparent;
     background-attachment:fixed;
     border-top:25px solid orange;
     border-left:120px solid orange;
     border-bottom:25px solid orange;
     border-right:10px solid orange;
     margin-left:150px 
}

“entergraph

这是简单而合理的。 使用衣物的功能如下:

.transparent {
   background-color: hsla(0,0%,4%,.4);
}

为此:

.transparent
{ 
  opacity:.50;
  -moz-opacity:.50; 
  filter:alpha(opacity=50); 
}




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...

热门标签