How to make CSS overflow visible render opaque elements

CSS overflow: a visible property allows content to be displayed outside the box element. However, Firefox displays content that overflows the window with a transparent background that makes visible below it. For instance:.

<div style = "background: red; height: 30px;">
I want this to have <br>
an opaque background.
</div>
<div style = "background: white">
So that it does not show what is below.
</div>

Is there a way to make all the contents of the first div complete using an opaque background?

+3
source share
2 answers

This is one of the solutions.

  • div (.. 30px).
  • 100% / ( css)

.

+1

:

HTML:

<div class="myDiv">
I want this to have<br>
an opaque background.
</div>
<div class="mySecondDiv">
So that it does not show what is below.
</div>

CSS:

.myDiv
{
background:red;
height:30px;
opacity: .75; /* Standard: FF gt 1.5, Opera, Safari */
filter: alpha(opacity=75); /* IE lt 8 */
-ms-filter: "alpha(opacity=75)"; /* IE 8 */
-khtml-opacity: .75; /* Safari 1.x */
-moz-opacity: .75; /* FF lt 1.5, Netscape */
}

.mySecondDiv
{
background:white;
}

, ( , ).

0

Source: https://habr.com/ru/post/1776403/


All Articles