I want to make a transparent box with content inside it with the image below..
I have no idea about creating this. Should I use HTML5 techniques? Would you please give me some help about creating this box?
I want to make a transparent box with content inside it with the image below..
I have no idea about creating this. Should I use HTML5 techniques? Would you please give me some help about creating this box?
Use rgba()
values for background-color
and control the opacity by changing the alpha value(rgba(r, g, b, a)
).
div {
background: rgba(100, 10, 10, 0.7);
width: 300px;
height: 250px;
border-radius: 30px;
text-align: center;
line-height: 250px;
color: white;
margin: 0 auto;
}
body, html {
background: url(http://www.lorempixel.com/600/400) 100% 100%;
width: 100%;
height: 100%;
margin: 0;
}
<div>Content</div>
Try something like this: http://jsfiddle.net/yb69nw1u/
HTML:
<img src="http://lorempixel.com/400/200" />
<div class="box-transparent">
This is some demo Text
</div>
CSS:
.box-transparent {
position: fixed;
top: 20px;
left: 20px;
background-color: rgba(100, 100, 100, 0.6);
padding: 20px;
}
The important thing is the rgba(100, 100, 100, 0.6);
line.
0.6 is the box's opacity.
You can use opacity property
div {
opacity: 0.5;
}
http://www.w3schools.com/cssref/css3_pr_opacity.asp
or you can make only background transparent with rgba background color:
div {
background-color: rgba(255, 0, 255, 0.5);
}
Use rgba as a background color.
background: rgba(30, 30, 30, 0.5) will give the background the color rgb(30,30,30) and an opacity of 0.5.
Just play a bit with the last value.