2

Before I begin, yes I know this question has been asked many times but I cannot get it to working anyway. I have a div which is transparent but the contents i.e. text and input fields that I dont wan't to be transparent.

Please don't link to previous answers as I followed them but without success.

Here's what my CSS code looks like:

.csmodal {
    height: 300px;
    width: 600px;
    background-color: rgba(25, 11, 36, .5);
    filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#7F00FF00', EndColorStr='#7F00FF00');
    float: none;
    display: inline-block;
    padding: 30px;
    margin: 200px auto;
    opacity: 0.4;
}

.cs-container {
    margin-right: auto;
    margin-left: auto;
}

#cs-headline {
    margin-bottom: 20px;
}

#cs-description {
    font-size: 14px;
    line-height: 20px;
    color: #eeee22;
}

h1 {
    margin: 10px 0;
    text-rendering: optimizelegibility;
    color: #eeee22;
}

HTML code:

<div class="cs-container">
    <div class="row">
        <div class="col-md-6 col-md-offset-3 csmodal">
            <h1 id="cs-headline">Website Launching Soon</h1>
            <div id="cs-description">
                <p style="text-align: center;">The launch of our official website is coming soon. Stay tuned!</p>
            </div>
            <form class="form-horizontal">
                <div class="form-group">
                    <div class="col-sm-10">
                        <input type="email" class="form-control" id="inputEmail3" placeholder="Email">
                    </div>
                </div>
            </form>
        </div>
    </div> </div>
Cesare
  • 9,139
  • 16
  • 78
  • 130
coding1223322
  • 461
  • 11
  • 26

1 Answers1

1

Specifying element opacity changes the opacity for the parent and all children.

Thinking in terms of functionality all we want is to be able to see the background. in that case we can apply a background color or an alpha channel like so: background-color:rgba({0 -255},{0 -255},{0 -255},[0 - 1] the last part determines opacity.

In case you want to have an image with an alpha channel you need to have a transparent asset. like so.

Use your imagination if you can position an element in absolute position and apply opacity to that and so on

raam86
  • 6,785
  • 2
  • 31
  • 46