Example
Fullscreen jsFiddle: http://fiddle.jshell.net/NathanJohnson/LrNBt/show/
jsFiddle: http://jsfiddle.net/NathanJohnson/LrNBt/
the code
HTML:
<div id="header"> <div id="header-content"> <h1>Here is some heading text :)</h1> <p>Here is some more content of the header...</p> </div> </div>
CSS
body { font-family: arial, sans-serif; padding: 0; margin: 0; } #header { background-color: black; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter: alpha(opacity=80); -moz-opacity: 0.80; -khtml-opacity: 0.8; opacity: 0.8; color: white; position: fixed; top: 0; left: 0; width: 100%; height: 150px; padding: 0; margin: 0; } #header #header-content { margin: 10px; }
Or you can just use rgba() instead of opacity :
#header { background-color: rgba(0, 0, 0, 0.8); color: white; position: fixed; top: 0; left: 0; width: 100%; height: 150px; padding: 0; margin: 0; } #header #header-content { margin: 10px; }
Hope this helps.
source share