Jump to content
  • 0

Проблема с прозрачностью (opacity)


sergiyko
 Share

Question

День добрый!

У меня есть такой код

<div style="background: green; padding: 10px; opacity: 0.4; position: absolute;">
<div style="width: 300px; height: 200px; background: #000; color: #fff; opacity: 1.0;">
TEST
</div>
</div>

Я хочу сделать первый div полупрозрачным, а следующим за ним не прозрачным. Ну вот хоть я и задал для него opacity: 1.0, он всеравно остается прозрачным. Как мне сделать чтобы второй div не был прозрачным?

Спасибо

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

выдрал из текущего проекта:

.b-glass { font-size: 1em; position: absolute; height: 4em; }
.glass-data { font-size: 1em; position: relative; z-index: 2; display: block; width: 100%; height: 100%; }
.glass {
position: absolute;
left: 0; top: 0; z-index: 1;
display: block;
width: 100%; height: 100%;
background: #000;

filter:progid:DXImageTransform.Microsoft.Alpha(opacity=70); /* IE 5.5+*/
-moz-opacity: 0.7; /* Mozilla 1.6 и ниже */
-khtml-opacity: 0.7; /* Konqueror 3.1, Safari 1.1 */
opacity: 0.7; /* CSS3 - Mozilla 1.7b +, Firefox 0.9 +, Safari 1.2+, Opera 9 */
}
.b-glass .txt { position: relative; z-index: 2; height: 100%; color: #fff; }

	<div class="b-glass"><div class="glass-data">
<div class="txt"><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p></div>
<div class="glass"></div>
</div></div>

думаю смысл будет понятен.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy